The issue with rewriting image with versioning

Comments

10 comments

  • Avatar
    Yakir Perlin

    HI,

     

    The version of an image is the timestamp of uploading the image and this parameter is generated by Cloudinary. 

    Maybe you should elaborate more on your use-case so I will try to do my best to help you?

     

    Thanks,

    Yakir

    0
    Comment actions Permalink
  • Avatar
    Igor M

    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

    0
    Comment actions Permalink
  • Avatar
    Yakir Perlin

    Hi Igor,

    You can remove the version parameter, like this:
    http://res.cloudinary.com/demo/image/upload/sample

    And 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

     

    0
    Comment actions Permalink
  • Avatar
    Igor M

    Hi Yakir,

    Invalidation is not an option for me due to delay. Is there any option to replace the image and make the latest version available immediately? I mean excepts changing public_id.

    Regards,

    0
    Comment actions Permalink
  • Avatar
    Yakir Perlin

    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 the version component with the updated value.

    Please let me know if it works for you

     

    Best,

    Yakir

    0
    Comment actions Permalink
  • Avatar
    Igor M

    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.

    0
    Comment actions Permalink
  • Avatar
    Yakir Perlin

    HI Igor, 

    Any new uploaded process generated a new version. 

    Could you please share with me your code?

    Best,

    Yakir

    0
    Comment actions Permalink
  • Avatar
    Igor M

    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?

    0
    Comment actions Permalink
  • Avatar
    Yakir Perlin

    Hi Igor,

    Thanks for the update.

    Could you please share with me your cloud name? So I will change your account setting to support invalidation of unversioned URL. 

     

    I'm looking forward to your response.

     

    Cheers,

    Yakir

     

    0
    Comment actions Permalink
  • Avatar
    Igor M

    Dear Yakir,

    Thank you for the prompt response

    I don't feel safe to publish my cloud name here. Sent it to you privately in LinkedIn.

     

     

     

    Thank you,

    Igor

     

    0
    Comment actions Permalink

Please sign in to leave a comment.