I want to duplicate an image from the Photo Library but I want to check in the future if I already have imported this image.
Immagine this scenario.
I have a photo in my Photo Library.
I import it in my app by making a copy of it.
I remove this photo from my library.
At a later time I reinsert this picture to my photo library (Same photo from iPhoto, just didn't synch it's album before and I have now)
Is there a unique identifier that I can use to compare the two pictures? is the URL unique?
Or do I have to look into the metadata and try to match it?
If so, what would you suggest? Created Data and location? Just created Date? Size?
Thanks for your advice.
Observations
I've been working with similar functionality, so this is what I know:
Each photo inserted into the photo library will have a unique URL (this means if you insert an image, delete it, then insert it again, even if it is the same image, it will have a new URL).
There is no straight forward way of knowing whether an image is a duplicate of a previous image or not.
I don't think you are trying to do this, but I will warn you that you cannot delete an image programmatically from the iPhone Photo library.
Solutions
I really only have one way of handling this: Create a hash of the photo and store the hash somewhere. If the photo inserted is the exact same photo as before, it should give you the same hash. You can use that hash comparison to determine if you are using the same photo or not. This is the method that I am using and it seems to work reliably for the most part. I have noticed some discrepancies, but these usually involve my work hashing the files before they are added to the photo library (I have noticed that the saved photo can be different from the photo that is being saved).
I hope this information helps. Let me know if I've missed anything or you notice different results in your work.
Related
I am building a game related with the picture of the client from his album.
I need him to authorize access his album, but can I use his pictures?
For example, imagine a game of finding errors. I use one of his pictures in my app, change 7 objects, and ask him to find the changes.
Is it possible?
The user will be able to give you access to their pictures. But in terms of identifying objects in the picture and making changes to them, you will have to code in some pretty advanced image processing functionality.
I am using UIImageWriteToSavedPhotosAlbum() method to save images in photo library.I am calling webservices to get images and saving it in photo library but It is creating copy of images because webservice is calling no. of time.
How can I replace existing images from Photo Library?
Thanks
No you can not, since this will allow you to update user images with their consent.
Apple is very restrictive about these kind of things, just image you are overwriting all the images by adding some banner. There is noway the user can undo this.
I’m trying to show Photo Streams using ALAssetsLibrary, but I haven’t find a way to know if a given ALAssetsGroup is the user photo stream (the one named “My Photo Stream”) or a shared one (arbitrary named by the user). Neither I have find how to know if the user created the shared photo stream or it was shared with him/her.
The only “clues” I have been able to find is that “My Photo Stream” is always sorted by date, but other streams might also be. The editable property is always NO for the streams I have tested with (in Photos.app you can edit shared photo streams, but not “My Photo Stream”, which is automatically managed). valueForProperty: doesn’t provided that many keys, and no key seems to provide much information (the URL looks like any other assets library URL).
I will not want to use the name (“My Photo Stream”) because our international users might have very different names, and Apple might have change it at any moment.
I also have noticed that it is always the first photo stream to be returned when enumerating the ALAssetsGroup from a library, but I haven’t found any documented evidence of this (it seems that the groups are returned in the order they were added). I have tested disabling and enabling the user photo stream from the Preferences and it keeps appearing the first… but only if it is enabled.
Other idea I haven’t tested is using + disableSharedPhotoStreamsSupport after I have enumerated the groups once, and then enumerate again, since the only photo stream left will be the user’s. But there is no + enableSharedPhotoStreamsSupport, so I will lose all the possible notification for those shared streams “forever”.
Does someone have some insight? Have someone managed to properly use the shared photo streams?
Like the title says. In an iPhone, in what directory do Instagram/Facebook (and similar applications) store the images they downloaded at runtime?
When is that directory wiped?
For non permanent images (e.g. post thumbnails but not user profile pics) I would imagine they get stored in the <Application_Home>/Library/Caches, other content probably goes in Documents
You don't need to know what facebook or instagram do, but If I understand your question right, you want to download images asynchronously from web and cache them. For that u can use a third party class to handle the caching instead of writing your own, I would suggest SDWebImage.
Am wondering if i can attach an image to my SMSComposerSheet (like the message application in the iPhone does). I've already implemented image picking (from library and camera)
So may be i need some thing to add in the displaySMSComposerSheet method to allow That.
One other thing, i want to do the same thing with mails sending, but i think that i couldn't, so i was thinking about saving the image into the application's sandbox then attach it to the mail. but i don't know how to do that :s
Thanks in advance
To try use this https://agilewarrior.wordpress.com/2012/02/08/how-to-attach-an-image-from-your-photo-gallery-and-send-it-as-an-image-on-iphone/