Good day,
How do I get the path of images from the ios 16 Photos Picker(PhotosUI Library) as I am trying to store the path in a json file to retrieve later to display
I have a form with a image picker and I want to store the path in json file and then later retrieve the path from the json file to show the image on another view.
There are no images and no paths. The photo library is a database.
You can get the photo asset's identifier if you have permissions, and then you can use that elsewhere to fetch the same photo from the database.
Related
plist file is stored in which pictures are displayed in scroll-view, made button "save", need help with the code. PLEASE!!
to do so, that would "save" button, save pictures in which I am. For example: I'm on the picture number 5, touch "save" and picture number 5 save to the gallery, I'm on the picture number 21, touch "save" and picture number 21 save to the gallery
If you want to create some photo gallery apps, check out this open source sample.
Created by Michael Waterfall, which includes photo gallery from images stored on server or locally.
Download the plist from server & provide the urls to the gallery app in the required format, then show the gallery view as given in sample.
In order to save the image to users photo album, in the sample code the class PhotoBrowserController handles the gallery task, which has the indexes of the photos next, current, previous.
Using the image get the image from saved cache and save it to users photo album using
UIImageWriteToSavedPhotosAlbum(saveImage,self,nil,nil);
Look at the sample app & go through the flow you will come to know how can modify for your requirements.
I am using ALAssetsLibrary to make an array of all images in the camera roll when my iPhone app starts. I store every image as a ALAsset * in an array.
Later in the app, I am saving an image to the gallery using this:
UIImageWriteToSavedPhotosAlbum(croppedImage, self, #selector(image:didFinishSavingWithError:contextInfo:), nil);
The image is saved successfully to the saved photos album. But, now my problem is that when I try to retrieve images using the existing array of all images, I don't get anything. Do I need to build the array of all images again or is there some other way to do this?
Saving an image changes the library and invalidates objects like assets from the library. You need to reload assets from the library whenever the library changes - do that when you receive an ALAssetsLibraryChangedNotification.
after getting a selected image in didFinishPickingImage:, is there a way to get the filename or name of that image? Is there any string that uniquely identifies that image or that is saved with the image at the moment image was added to the photo album?
You can check the metadata, but from my tests the title does not seem to be there or anywhere else.
I have developed a small iPhone application in which a user can choose images from an image picker and that image will appear in a View. When the user first selects an image I have saved the image name to a database and I save that image to a resource folder with that name. When the main view appears I search for images from the resource folder and display that image in the main view.
When I run this application in the iPhone Simulator it successfully runs, but when I actually tried it for testing purposes on my iPhone I am not able to display images in the main view. Anyone have an idea what's wrong with that?
Hi shivang,
I think you are saving the image to NSDocumentDirectory on a first click and trying to reload that.
while retriving the files from the NSDocumentDirectory you better
first check it for the file type like jpg,png,mp3 then give the
exact name to retrive that.
NSDocumentDirectory creates unique memory for every app and its
limited,check for the size of the images u r saving.
better try this code
for (NSString* fileName in [fileManager contentsOfDirectoryAtPath:myfilepath error:nil])
{
if ( [fileName rangeOfString:#".jpg"].location != NSNotFound )
{
// Here fileName is used as a temporary variable to retrive image name
// myfilepath is the path where u stored the images
}
}
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.