Get URL in Callback Response with Simple Upload Form

Comments

1 comment

  • Avatar
    Daniel Mendoza

    Hi,

    My question is: since I'm setting the public_id value, and the file's extension/type is returned to me, I can still access the image publicly by visiting cloudinary.com/mycloudname/image/upload/foofoo.png  (that is, omitting the v1648074883 part of the URL, which I never receive).Is this fine, expected behavior?  Just want to make sure this method of referencing (going straight to /upload/filename.extension) isn't going to disappear in some future build.  

    • The full version e.g. `v1648074883` can be omitted from the URL. It is used mainly for cache busting, meaning you want to pull the latest version of the image, you can just update that value to the current timestamp and it will fetch the latest asset.

    Hitting an image at /upload/filename isn't ideal, because if a user uploads several times and they are all saved as filename foo, the CDN may not cache the latest one right away, so I end up with a variety of "foo" images showing up until the CDN finally catches up. 

    • If they all have the same public id, just make sure to include the parameters `invalidate` and `overwrite` set to true, and those assets will be invalidated at the CDN, so you should always get the latest. When you destroy an asset you should also do `invalidate` set to `true`.

    or future releases, returning the full URL as part of the callback GET payload during a basic web POST might be helpful, so we can reference the latest image and avoid caching issues.

    • This shouldn't matter, the upload response you shared has everything you need to generate the cloudinary URL. In your database you should save `public_id`, `format`, `resource_type`, `type` and if needed `version`. With these parameters you can generate the Cloudinary URL via one of our SDKs or just by constructing it yourself here.

    Hope this helps.

     

    0
    Comment actions Permalink

Please sign in to leave a comment.