3

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.

3
  • will u send that string once? Commented Mar 28, 2013 at 7:17
  • so I get string of image in way for loop from server and dsiplay in tableview cell (any cell different image) Commented Mar 28, 2013 at 7:20
  • if possible then get image url from server (in php file response) not get image base64 data. and use EgoImageView insted of UIImageView for display image in cell EgoImageView Commented Mar 28, 2013 at 7:20

2 Answers 2

1
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.

Sign up to request clarification or add additional context in comments.

1 Comment

thanks my friend this code run image or decode string to image?
1
NSData* data = UIImageJPEGRepresentation(yourImage, 1.0f);

 NSString *strEncoded = [Base64 encode:data];

Decode as:

 NSData* data = [Base64 decode:strEncoded ];;
 image.image = [UIImage imageWithData:data];

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.