1

In my app, I would allow the user to pick a photo from the gallery (or snap a photo/video with the camera).

I need to save the path in a db to retrieve it later, but I don't understand how I can do it.

** EDIT **

I didnt' resolve this issue, so now I save the images locally and I save the local path in the db.

Sefran
  • 375
  • 6
  • 24
  • have you tried with UIImagePickerControllerReferenceURL key of info dictionary returned in didfinishpicking method ? – Ravin Apr 17 '11 at 16:42
  • UIImagePickerControllerReferenceURL should be present from ios 4.1, but in addition to this, I don't know how use it when the img is captured on the go and not chosen from the gallery. – Sefran May 02 '11 at 19:04

1 Answers1

0

I've never used UIImagePickerControllerReferenceURL, but I'd assume that you use it as any other URL:

[UIImage imageWithData:[NSData dataWithContentsOfURL:url]];
Erik B
  • 40,889
  • 25
  • 119
  • 135
  • The problem wasn't in retriving the uiimage corresponding to an url, but the url corresponding to an image taken on the fly, if any. Instead, for a image taken from the gallery, UIImagePickerControllerReferenceURL could work (but it's present only from ios 4.1). – Sefran Jun 02 '11 at 12:53
  • @Objnewbie I don't really see the problem. If `UIImagePickerControllerReferenceURL` is available, use it. If not just save the image locally. – Erik B Jun 02 '11 at 12:58
  • indeed I save images locally, because I have to maintain compatibility respect to ios 3.1. Moreover, when the image is taken on the fly, UIImagePickerControllerReferenceURL doesn't work, it has a value only for images chosen from the gallery. – Sefran Jun 02 '11 at 16:13