如何从照片库获取图像路径并从iphone中的照片库中检索图像? [重复]

时间:2022-11-14 13:03:36

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

可能重复:如何从照片库获取图像路径以及如何从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.

我是iphone的新手。在我的小应用程序中,如何从照片库获取图像路径。我使用以下代码来获取图像并放置在imageview中。

-(IBAction) selectimage
{
    UIImagePickerController * picker = [[UIImagePickerController alloc] init];
    picker.delegate = self;
    //picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
    if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary])
    [self presentModalViewController:picker animated:YES];  
    NSLog(@"UIPicker=%@",picker);
}

- (void)imagePickerController:(UIImagePickerController *)UIPicker didFinishPickingImage:(UIImage *)info editingInfo:(NSDictionary *)dictionary

{
imageView.image=info;
[UIPicker dismissModalViewControllerAnimated:YES];
NSLog(@"UImage path= %@",imageView.image);
}

Its succefully placed to Imageview. But i cant get its imagepath for storing into DB. I'm using NSLog("Image path= %@",imageview.image); it shows "Image Path= UIImage: 0x6819790" in console. How can i get its path and how to retrieve photos from photo library.

它成功地放置在Imageview上。但是我无法将其imagepath存储到DB中。我正在使用NSLog(“Image path =%@”,imageview.image);它在控制台中显示“Image Path = UIImage:0x6819790”。如何获取其路径以及如何从照片库中检索照片。

My current process goes like this: UIImagePickerController -> User Chooses Image from Photos -> chosenImage is set to instance of UIImageView -> Now I want to take this image and store it in the DB.

我当前的过程如下:UIImagePickerController - >用户从照片中选择图像 - > selectedImage设置为UIImageView的实例 - >现在我想拍摄此图像并将其存储在数据库中。

How can i get its image path for store into db and how can retrieve image from db using its imagepath. Any body help me. Thanks in advance.

如何将其存储到db的映像路径以及如何使用其imagepath从db中检索映像。任何身体帮助我。提前致谢。

1 个解决方案

#1


1  

i think this link will help you.
you can also find code there.

我认为这个链接会对你有所帮助。你也可以在那里找到代码。

#1


1  

i think this link will help you.
you can also find code there.

我认为这个链接会对你有所帮助。你也可以在那里找到代码。