Reputation: 2969
How can I overwrite images I upload to cloudinary so I do not duplicate and have multiple images that are all exactly the same ?
Upvotes: 1
Views: 1161
Reputation: 460
Say you have an image called "sample_image" in your account and you want to upload another image with the same name, you can simply upload it while setting the public_id
to "sample_image" and add the overwrite
parameter.
Also, you probably want to purge the old image from the CDN to make sure you're delivering the newest version, so set the invalidate
flag to true
in the upload call as well.
cloudinary.uploader.upload('my_image.jpg', function(result) { console.log(result) },
{ public_id: "sample_image", overwrite:true, invalidate,true });
Upvotes: 2