iphone - Storing a reference to an image saved in the Camera Roll -


"itemprop =" text ">

I work on a simple application which allows the user to take a picture and store it in the camera roll for later Is doing the use . To do this, I'm using a UIImagePickerController, and the method is UIImageWriteToSavedPhotosAlbum, which is working perfectly

My question is: Is there a way to store paths for the image in the camera roll Is there a way to use to call that image again? Or, do I have to save the image in the app to use it again?

It would be great that this was an easy way to do this, because with a video where you simply store NSUrl for special videos, and then do everything for you to say MPMoviePlayerController.

Any help would be greatly appreciated!

It is found that this is not really difficult to do this in the UIImagePickerDelegate method:

  - (zero) imagePickerController: (UIImagePickerController *) Picker didFinishPickingMediaWithInfo: (NSDictionary *) information;   

NSDictionary "info" is actually the image or movie URL that is stored on the camera roll. You only need to check:

  if ([[info valueForKey: UIImagePickerControllerMediaType] isEqualToString: (NSString *) kUTTypeMovie]) {// user a video, movieURL = [[Info valueForKey Taken: UIImagePickerControllerMediaURL];]; // Get the URL where the movie is stored. UISaveVideoAtPathToSavedPhotosAlbum ([movieURL path], zero, zero, zero); // Save the movie to the photo album. }   

and this will save the camera roll, as well as record the URL. This is similar to the picture, just replace "Coot Type Movie" with "Cootatize", and

  Movie URL = [[[info valueForKey: UIImagePickerControllerMediaURL]]; // movie is stored UISaveVideoAtPathToSavedPhotosAlbum ([movieURL path], zero, zero, zero); // Save the movie to the photo album. With    

  UIImage * image = [info valueForKey: UIImagePickerControllerOriginalImage]; UIImageWriteToSavedPhotosAlbum (image, zero, zero, zero);   

If you do not need to store UIImage on the camera roll, then there is a great post on the stack overflow that you can use to store the image in your app. Hope that helps anyone!

Comments