My intent:
I want my app to upload images to S3. If image already exists, server should record a reference to existing image rather than asking for an upload of another copy.
How I imagine that works:
- Hash image data
- Send hash to server with request for signed url (to upload to AWS S3)
- If hash matches something already stored, reference it and tell app
Initial thoughts:
Use imageEditor.cropImage
to get image into ImageStore, which will give me an appropriate uri. Then use getBase64ForTag(uri, success, failure)
to retrieve base64 data for a hash calculation.
The problem:
According to the answer on this question, this process is not efficient in the least. The usual solution would be to use native methods, as described in the answer to this question, however I do not want to eject my Expo app for this feature.
My Question:
Is there a better way to hash image data? Or more fundamentally, is there a better way of ensuring that identical images are not duplicated in S3 storage?