The issue with rewriting image with versioning
Hi,
I try to upload an updated version o an image via Cloudinary API and Dropzone.js:
myDropzone.on('sending', function (file, xhr, dropzoneFileUpload) {
dropzoneFileUpload.append('public_id', item_id);
dropzoneFileUpload.append('api_key', '%API_KEY%');
dropzoneFileUpload.append('version', Date.now() / 1000 | 0);
dropzoneFileUpload.append('upload_preset', '%UPLOAD_PRESET%');
});
I expect the new image will receive the new version that I've provided in the version attribute.
However, this never happens.
The callback responses with the initial version and URL.
The system doesn't reference the provided version attribute.
Thanks.
-
Hi Yakir, thanks for the additional information, but that's the problem.
I try to generate a version component automatically upon uploading a new picture with already existing Public ID and expect a new version to be generated by Cloudinary and returned in a callback. However, Cloudionary returns the same version as it was before uploading a new picture.
How can I force Cloudinary to generate a new version if I upload a new picture with a new Public ID?
Thanks.
-
Thank you, Yakir. I'm trying to implement the following functionality:
1. User uploads the image
2. Later user can replace the image with another one, with the same public_id
I expect that when the user replaces the old image with the new one having the same public_id, the Cloudinary system will respond with a new version which is a part of unique URL. This way I can fetch the most updated image overriding the CDN. However, I get the same "version" when replacing the image
-
Hi Igor,
You can remove the version parameter, like this:
http://res.cloudinary.com/demo/image/upload/sampleAnd while uploading a new image, with the same public_id you can set the invalidate parameter to true in order to invalidate the previous image throughout the CDN.
Note that it usually takes a few minutes (although it might take up to an hour) for the invalidation to fully propagate through the CDN, while the version component takes effect immediately.
Please let me know if it works for you.
Best,
Yakir -
Hi Igor,
So just make sure to include the version component as part of the URL in order to bypass CDN cached version and to force the delivery of the newest image.
Cloudinary returns the updated value of the
version
parameter as the part of every upload response.The
url
parameter is also returned which already includes theversion
component with the updated value.Please let me know if it works for you
Best,
Yakir
-
Hi Yakir,
after some break I return to solve this issue.
I'm uploading a new version of the existing image, get a new version number, but I want be sure I remove the old version of the image.My question:
Is it enough to specify the «invalidate» parameter to force Cloudinary to remove the outdated image?
Post is closed for comments.
Comments
10 comments