Getting image name of iphone photo library - iphone

I'm doing a project to take images from iphone photo library or in other way from camera roll. I have done that without any problem. But i need to retrieve the name from the photo library. Is there a way to do that? Any help is appreciated
Thanks

Have a look at ALAssetsLibrary which is available in iOS 4.0 and later.
Also, these links may help
How to get a photo's original filename in iOS?
iPhone: How do I get the file path of an image saved with UIImageWriteToSavedPhotosAlbum()?

If you need the full path, just use this:
ALAsset* asset; // previously assigned
NSDictionary* pathInfo = [asset valueForProperty:ALAssetPropertyURLs];
This will leave the full URL of the image on your device as the Value member of the pathInfo object.

Related

how to get iphone ipod playlist images and display it in image view

I am working with iphone ipod to read the album and playlist and play it in my application.
My question is that that i get the image from the album i have selected. and it is also working well in my application.
But i never get images from the playlist which i have selected their are different songs in my playlist and also having different image for that songs. for the album i have get the code and it work great. i am new for this and i cant found any reference code for this.
And i am using AVPlayer to play the songs.
So please help me and provide some sample code. for how to get all images from playlist and convert that image to data in iphone.
Please help me.
You're looking for is the MPMediaItemPropertyArtwork for MPMediaItem. As stated in the docs. After getting the artwork property you can make a MPMediaItemArtwork object, as stated in the docs.
An MPMediaItemArtwork object, or media item artwork, represents a graphical image, such as music album cover art, associated with a media item. Media items are described in MPMediaItem Class Reference.
With this you can do something like this. Assuming song is an MPMediaItem:
UIImage *image = nil;
MPMediaItemArtwork *itemArtwork = [song valueForProperty:
MPMediaItemPropertyArtwork];
if(itemArtwork != nil)
image = [itemArtwork imageWithSize:CGSizeMake(100,100)];
Now you have image containing your MPMediaItem artwork, set it to your image view ([myImageView setImage:image]). Keep in mind, this will only work if artwork IS available.
Hope this helps.
You can use VTM_AViPodReader demo for this.

Get actual file name when using writeImageToSavedPhotosAlbum for iOS

I'm writing an AR app that takes a screenshot and then places the image in the photo album so that the end user can get to it. I'm using writeImageToSavedPhotosAlbum. The major issue I'm having right now is that I can't seem to get the filename of the image.
I'm getting something like the following from NSURL:
assets-library://asset/asset.PNG?id=8AD512D0-205E-424D-B466-F31CCE4F299C&ext=PNG
When I need something like:
Image_0050.png
Does anyone know how to get the actual image name? Or, maybe I'm going about this entirely wrong?
Thanks,
Nathan
There is no name. All you have is a UIImage object.
The information you need is in ALAssetRepresentation of any ALAsset. All you need to do is get default representation of current asset and then you will have access to all information you want.
ALAsset *asset = <some_asset>;
NSLog(#"filename %#", asset.defaultRepresentation.filename);

Is there a way to get paths of all the images of CAmera roll

Is there any way to create an array or something
having paths of all the images stored in camera roll.
Please enlighten me on this.
Thnx in advance
SpyPhone uses a direct path to the users photo library:
http://github.com/nst/spyphone/
It seems that any application can read it. However, this seems like falls under the area of "undocumented API" and could well be rejected in a real application.
I don't think there is. As far as the API is concerned for the UIImagePickerController you can only get a single path for a Movie that was recorded by the user (if running 3.0 on a 3GS). And even that path is a file URL to the temporary folder where the movie is stored before being written to the library.
You can't get paths for any images in the photo library or the camera roll.
When you pick an image using the UIImagePickerController the controller returns the Original Image and an "Edited Image" if the image was edited before being chosen.

Retrieving an iPhone photo saved to the photo library

I am saving images to the photo library and would like to retrieve them dynamically to display in future launches of my app. I use the WriteToSavedPhotosAlbum function, as below, but do not get any info to access the saved photo programmatically.
UIImageWriteToSavedPhotosAlbum(UIImage *image, id completionTarget, SEL completionSelector, void *contextInfo);
Once saved, is there a way to retrieve the file name/id and load an image from the photo library at a later time?
You just need to save them for yourself.
Possibly in your app's documents or cache folder.
As a side note, when you say: "display at launch", if you mean to replace the Default.png, that won't work.
The launch image must be static and included in your app bundle.
If not, disregard.
You can't, unless the user picks the photo using the UIImagePickerController.
Check this related question
try this code segment make the necessay changes
UIImagePickerController *picker=[[UIImagePickerController alloc] init];
picker.delegate=pickerDelegate;
picker.sourcetype=UIImagepickerControllerSourceTypePhtoLibrary;

Save photo to iphone camera roll with a custom name

I am trying to save a photo taken from my app to camera roll, this can be done by using UIImageWriteToSavedPhotosAlbum, however, I noticed there isn't any way to set the photo name by using this approach, am I right?
I also tried to save a image file with a name by using UIImageJPEGRepresentation, however, I can only save it to my app's document folder but not camera roll.
Is there any way to save photo to camera roll with a custom name?
Thanks advance for your kindly help.
John
no, no way to save with a custom name to the camera roll.
There is a way to kinda do that, by setting the image metadata:
if you set the IPTC metadata field "Object Name", this will be shown as the image title in iPhoto.
See details (and code) at http://ootips.org/yonat/how-to-set-the-image-name-when-saving-to-the-camera-roll/ .