Can I update my image link?

Comments

9 comments

  • Avatar
    Itay Taragano

    Cloudinary delivers all images and raw files through a fast content delivery network which caches files for increased performance. This means that accessing a new file at the same exact URL of the file it replaced (including the same version number), might return the previous version of the image. 

    When you upload a file to Cloudinary without specifying a public ID, a new random ID is automatically generated for that image. Its 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 new 'version' number to the image's URL to force the new file 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. It is recommended to add the version part to bypass CDN caching.

    Another option you can choose is to set the  invalidate  parameter to  true  while uploading to invalidate any cached versions of your image and forcing the delivery of the new image. Here's an example in rails:

    Cloudinary::Uploader.upload('new-image.jpg', :public_id => 'image', :invalidate => true)

    Note that it might take up to 1 hour for the invalidation to fully propagate.

     

    0
    Comment actions Permalink
  • Avatar
    Sebastian Bromberg

    Thanks! I'll check it :)

    0
    Comment actions Permalink
  • Avatar
    Doug Krugman

    Is there a way to set  invalidate  to  true  when uploading through Cloudinary's Media Library > Upload Images interface? 

    0
    Comment actions Permalink
  • Avatar
    Itay Taragano

    When uploading / deleting via the Media library, Invalidation is enabled by default.

    0
    Comment actions Permalink
  • Avatar
    Doug Krugman

    hmmm...this doesn't seem to be the case. we have uploaded images using the same name and returns the old version if the version component of the url isn't included.

    0
    Comment actions Permalink
  • Avatar
    Itay Taragano

    Hi Doug, 

    Can you please share an example of a URL which wasn't invalidated for you? If privacy is an issue, you're always welcomed to open a support ticket.

    0
    Comment actions Permalink
  • Avatar
    Doug Krugman

    i'm confused - uploading an image with an existing filename (basically, updating an image) - without using the version as part of the url - would return the 'old' copy that was in the CDN, well over an hour later. ...much like this link: http://support.cloudinary.com/entries/23138893-I-ve-replaced-an-existing-image-with-a-new-one-but-my-website-stills-shows-the-old-one-Why-is-that-

    ...has the cloudinary's web uploading (media library > upload images) interface changed recently?

    we are in the process of writing a little script to use your API (and pass invalidate: true) because uploading via the web (again, using the same filename, and *not* using the version) would not invalidate the CDN by default.

    0
    Comment actions Permalink
  • Avatar
    Itay Taragano

    Hi Doug,

    If you encountered any specific issues with images which weren't invalidated successfully, please share some more information with us, including the specific URLs and maybe the time of the image update, so we'll be able to able to further understand the issue. 

    Thanks

    0
    Comment actions Permalink
  • Avatar
    SIS

    Go the same issue
    -old file
    http://res.cloudinary.com/sistv/image/upload/badges/leonesa.png

    new file http://res.cloudinary.com/sistv/image/upload/v1441617255/badges/leonesa.png

    Uploaded about an hour ago (2015-09-07 09:14:15)

    Any idea what this happened ?

    0
    Comment actions Permalink

Please sign in to leave a comment.