Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get image path from photo library and how to retrieve the image from photo library in iphone?

I'm new to iphone. In my small application, how to get image path from photo library. I use this following code to getting images and placed in imageview.

-(IBAction) selectimage
{
UIImagePickerController *picker=[[UIImagePickerController alloc] init];
picker.delegate=self;
picker.sourceType=UIImagePickerControllerSourceTypeSavedPhotosAlbum;
[self presentModalViewController:picker animated:YES];
[picker release];
}
-(void) imagePickerController:(UIImagePickerController *)UIPicker didFinishPickingMediaWithInfo:(NSDictionary *) info
{
[UIPicker dismissModalViewControllerAnimated:YES];
imageview.image=[info objectForKey:"UIImagePickerControllerOriginalImage"];
    NSLog("Image Path=%@",imageview.image);
}

Its succefully placed to Imageview. But i cant get its imagepath. I'm using nslog("%@",imageview.image); it shows "Image Path=" in console. How can i get its path and how to retrieve photos from photo library. Any body help me. Thanks in advance.

like image 424
akk Avatar asked Oct 15 '11 10:10

akk


People also ask

Where does Apple Photos store files?

By default, the System Photo Library is located in the Pictures folder on your Mac. You can also create additional photo libraries on your Mac and on other storage devices. You should always use the Photos app to access the photos in a Photos library.

Where are my photos stored on iPhone?

Your original photos and videos are stored in iCloud and space-saving versions are kept on your device. Your library is optimized only when you need space, starting with the photos and videos you access least. You can download the original photos and videos over Wi-Fi or cellular when you need them.

How do I pull photos off my iPhone?

Open the Photos app on your computer. The Photos app shows an Import screen with all the photos and videos that are on your connected device. If the Import screen doesn't automatically appear, click the device's name in the Photos sidebar. If asked, unlock your iOS or iPadOS device using your passcode.

How do I move photos from Photos app to folder?

On your Android phone, open Gallery . Press and hold the photo or video you want to move. Move to folder.


1 Answers

UIImagePickerControllerOriginalImage returns only the image's data, with no reference to its local storage. I haven't used it myself but I guess what you are looking for is

NSURL* localUrl = (NSURL *)[info valueForKey:UIImagePickerControllerReferenceURL];

At least, it's the only way I know of to retrieve any URL.

To retrieve the image, have a look at this question. But also keep in mind, that you already have the image retrieved with

UIImage* image=(UIImage*)[info objectForKey:@"UIImagePickerControllerOriginalImage"];

so ask yourself if you really need this.

like image 120
Philipp Schlösser Avatar answered Nov 15 '22 20:11

Philipp Schlösser