views:

421

answers:

2

I have this bit of code that get the image i have picked from the Camera and displays it into a UIImageView. I want to convert the image to a binary string so i can then make a URL call and pass it back to the server. How would I modify this code to get my binary string?

- (void)imagePickerController:(UIImagePickerController *)picker 
        didFinishPickingImage:(UIImage *)image
                  editingInfo:(NSDictionary *)editingInfo {
    imageView.image = image;
    [picker dismissModalViewControllerAnimated:YES];

}
+1  A: 

You should better pass the NSData got from image jpeg representation to the server by POST method.

Marco

Marco
Can you show an example?
MartGriff
To get data from your image:myImageData= UIImageJPEGRepresentation(myImage,compressionQuality);//compressionQuality range from 0.0 (worst quality) to 1.0(best quality)Here is how to use POST method:http://www.iphonedevsdk.com/forum/iphone-sdk-development/21645-using-post-method.htmlMarco
Marco
A: 

You can find an example of how to do it from Apple in this technote. Not as easy as it should be, but appears that it's the only way to do it. Is it possible for you to get the data before it becomes a UIImage to make your life a little easier? If not, just try the method presented at the link.

Gordon Worley
He doesn't need the raw bitmap data.
Marco
How do we know? I don't think he said.
Gordon Worley
Guys, My Goal is to transfer the image taken to a server via a http Post so not sure it I would need the RAW or not??
MartGriff
Because he doesn't need to manipulate the image pixel by pixel, so it's a waste of memory. It's also e waste of internet connection to send the pixels data.
Marco
MartGriff, follow the hint i gave you.
Marco