yavg
yavg

Reputation: 3051

how can I change the name of an image in cloudinary from the api

For example I have this image:

http://res.cloudinary.com/xxxx/image/upload/v1520903853/tt/aa/ee/E14/name_2018-03-12_19_17_31.jpg

I need rename to:

myname.jpg

and move to the route:

/tt/aa/

how can do it? I am using javascript

Upvotes: 0

Views: 861

Answers (1)

Shirly Manor
Shirly Manor

Reputation: 301

In order to rename an image, you can use our API. However, because it is signed (for security reason) you will need to use server-side script. For example in NodeJS:

cloudinary.v2.uploader.rename(from_public_id, to_public_id, options, callback);

In your case:

cloudinary.v2.uploader.rename("tt/aa/ee/E14/name_2018-03-12_19_17_31", "/tt/aa/myname", options, callback);

Please note, in order to bypass the CDN caching, you can include the invalidate parameter in your POST

You can read more about it here: https://cloudinary.com/documentation/image_upload_api_reference#rename

Upvotes: 1

Related Questions