Reputation:
I want get string of image in way base64 from (php file) in server.
but I don't know what decode this string and convert to image and display in UIImage.
Upvotes: 3
Views: 3795
Reputation: 87
NSData* data = UIImageJPEGRepresentation(yourImage, 1.0f);
NSString *strEncoded = [Base64 encode:data];
Decode as:
NSData* data = [Base64 decode:strEncoded ];;
image.image = [UIImage imageWithData:data];
Upvotes: 1
Reputation: 452
NSURL *urlString = [NSURL URLWithString:@"your string"];
NSData *imageData = [NSData dataWithData:UIImagePNGRepresentation([UIImage imageWithData:
[NSData dataWithContentsOfURL:urlString]])];
UIImage *image = [UIImage imageWithData:imageData];
Try this.....may be use full for u.
Upvotes: 1