Reputation: 2327
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.
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.
Upvotes: 4
Views: 2277
Reputation: 4955
Observations
I've been working with similar functionality, so this is what I know:
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.
Upvotes: 3