Uploading the same image file with different crop doesn't update version
I'm using the uploader widget with an uploadSignature and cropping. It works great except that the version doesn't update when I upload the same image twice in succession with different custom_coordinates. Is there a way to force a version update on upload? As it is, if a user wants to reupload the same image with a different crop, it won't work. Thanks in advance.
-
Hi Paul,
When uploading an image to Cloudinary we check to see if the same exact file with this public_id already exists on your cloud. If we detect that the same exact image with this public_id already exists on your account we don't upload it again. So re-uploading the same file with different coordinates won't overwrite the existing file.
What you can do, is first delete the existing file with this public_id and then re-upload the new image. Deleting the image can be done in two ways:
1. Using the destroy method via your server-side (don't forget to include the `invalidate` parameter set to `true`) As explained here: https://cloudinary.com/documentation/image_upload_api_reference#destroy.
2. Deleting via the upload widget by setting the `Return delete token` parameter to `true` in your upload preset. Then in your upload widget configuration, you would need to set the `thumbnails` parameter to the id of the HTML element that would be set as the container for the upload thumbnails. After your user clicks 'done' and uploads the image, he would see a thumbnail with an X on the top which would allow him to delete the image. This delete option is available for only 10 minutes after the image was uploaded. You can read more about this delete option here: https://cloudinary.com/documentation/upload_images#deleting_client_side_uploaded_assets.Alternatively, you can use the explicit method on your server-side, to update the coordinates of an existing image.
More info here: https://cloudinary.com/documentation/image_upload_api_reference#explicitLet us know if you need any further assistance.
Best regards,
Post is closed for comments.
Comments
1 comment