Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete a single Cloudinary image from browser?

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.)

like image 245
pradeep Avatar asked Jan 01 '26 18:01

pradeep


1 Answers

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});   
}
like image 138
pradeep Avatar answered Jan 03 '26 10:01

pradeep



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!