Here I am using Cloudinary
Upload widget to upload images into cloudinry.
How can I delete a particular image from Cloudinary
through browser(here I have image details like public_id
,imageName
,url
,etc.)
With the help of publicId we can delete the image(s)/video(s)/etc.Below is the working code.
publicId --- cloudinary publicId.
resourceType ---- image/video/raw
function deleteImage(publicId,resourceType,callback){
console.log(resourceType);//image,video,raw
cloudinary.api.delete_resources(publicId, function(result) {
console.log(result);
if(result.hasOwnProperty("error")){
callback(result);
return;
}else{
callback(result);
}
},{all:true,resource_type:resourceType});
}