Retaining the exact URL when a file is replaced with the same filename.

Comments

4 comments

  • Official comment
    Avatar
    Akshay Joshi

    Hi Matt,
    Cloudinary automatically adds the version to URLs and this cannot be changed through configuration.  You can safely strip off the version token from the URL to access the asset.  For example:
    https://res.cloudinary.com/demo/v1341324/sample.jpg is the same as https://res.cloudinary.com/demo/sample.jpg .  Maybe you can try the following (assuming you are using our upload APIs to upload from the browser):
    - Upload the new version of the asset
    - Get the version assigned to it from the upload response.  The version string is available in the response as 

     "version": nnnnnnnnn,

    See https://cloudinary.com/documentation/image_upload_api_reference#upload_response for a sample response. 
    - Programmatically Strip off the version in the url that is returned in the response and use it in your app.

    "secure_url": "https://res.cloudinary.com/demo/image/upload/v1570979139/eneivicys42bq5f2jpn2.jpg",

        
    Best
    Akshay

    Comment actions Permalink
  • Avatar
    Eric Pasos

    Hi Matt,

    The version of an image in the Media Library is the timestamp of when your was last updated (e.g., v1366687335), and you may remove it from your delivery URL (see https://cloudinary.com/documentation/advanced_url_delivery_options#asset_versions). Cloudinary does not require the version component to be present in URLs, and it can be removed if you don't want to use that when building your URL.

    For example:

    https://res.cloudinary.com/company/image/upload/folder/file.png

    Hope this helps.

    0
    Comment actions Permalink
  • Avatar
    Matt Broad


    Hi Eric,

    Thank you very much for the reply and link. Please could you or anyone confirm which settings need to be applied?

    I have tried changing the ' Invalidate versioned URLs: Enable this if you use URLs with the version component, e.g. https://res.cloudinary.com/iporg/image/upload/v1637067637/sample.jpg ' and many other settings but the timestamp remains. Also, is there a way to reset all settings to default? I've tried many other them in attempt to get this working.

    Thank you

    Matt

    0
    Comment actions Permalink
  • Avatar
    Matt Broad

    Hi Akshay,

    Thank you very much for your reply. We're uploading through the web interface and currently we are not using the API. Images are therefore just called by their URL. I think from what you've described this means we cannot remove the version from the URLs

    As per your example, when the URL is like this
    https://res.cloudinary.com/demo/v1341324/sample.jpg
    we want to call a URL like this
    https://res.cloudinary.com/demo/sample.jpg 

    We wish to do this so we can replace the file e.g. sample.jpg with a new one by the same name. We want to do this by uploading through the web interface and overwriting or deleting the existing sample.jpg

    Please confirm if this can be achieved without the API, else we will need to use another provider.

    Thank you

    Matt

    0
    Comment actions Permalink

Please sign in to leave a comment.