Cloudinary delivers images and transformed images through a fast content delivery network which caches images for increased performance. This means that accessing a new image at the same exact URL of the image it replaced, might return the previous version of the image.
When you upload an image to Cloudinary without specifying a public ID, a new random ID is automatically generated for that image. It's URL will be unique and you will always get the latest version.
If you do specify a public ID, you will need to add the 'version' parameter to the image's URL to force the new image to show. When you use our upload API, the upload result will contain the 'version' value and a URL with the version part already included.
Alternatively, you can ask to invalidate the caching of the older version of the image.
Comments
6 comments
[deleted]
Hi,
If I upload an image providing the public_id and therefore overwriting it, will I be able to retrieve the older version? Is there an endpoint for retrieve the file version history and get the file versions timestamps?
Thank you.
Hi Agustín,
I apologize for the delay in response.
Upon overwriting an image you will be able to retrieve an older version if you have automatic backup enabled and want to revert to a specific version.
You can read more on how to do that in this article:
https://support.cloudinary.com/hc/en-us/articles/214000185-How-to-restore-an-overwritten-deleted-resource-from-backup-
If you want to simply access/view a versioned image you can also click on the version number which will bring up the corresponding image and you can download the image from there.
You can read more on this here:
http://cloudinary.com/blog/automatic_backup_of_user_uploaded_images_using_cloudinary
However, if you would like to have multiple versions of an image you can always place them into a folder so that you can consolidate the different image versions all into one place without having to switch back and forth. Then you can have a setup similar to something like test_folder/img1, test_folder/img2, etc.
Thanks,
Marissa
Hi there,
I'd like clarity on the management console's invalidate option. Does disabling it mean that whenever I update an image it will immediately invalidate the cached version(s)? If not, how can I achieve that effect? My application lets users update their profile pictures, for example, and they expect to see their latest one as soon as they update it.
Please assist.
Thanks
Hi Siphiwe,
The best way to make sure you’re providing an up to date image is by including the version number in the URL. This allows bypassing a previously cached version of the image. If you’d like to read more about image versions feel free to take a look at this article:
https://support.cloudinary.com/hc/en-us/articles/202520912-What-are-image-versions-
Or you can also read our documentation here:
http://cloudinary.com/documentation/image_transformations#image_versions
Regarding the console's invalidate option, please keep in mind that this option enables invalidating versioned images only. So you must always be sure to include the version number in your URL. If you don't include the version number in your URL then it will not be invalidated. You can read more about invalidating cached resources and the difference between versioned and unversioned resources in our documentation here:
http://cloudinary.com/documentation/upload_images#invalidating_cached_images_on_the_cdn
Thanks,
Marissa
Is there any option to pass version in cl-image in angular 4
Please sign in to leave a comment.