How to delete a image?

shivam9aug1996
shivam9aug1996 Member Posts: 1
edited January 2 in Developer APIs

https://res.cloudinary.com/dc2z2c3u8/image/upload/v1704056782/uploaded-images/Screenshot%202023-12-31%20at%205.39.20%20PM.png.png


I need to delete this image


cloudinary.uploader.destroy(

`image/upload/v1704056782/uploaded-images/Screenshot%202023-12-31%20at%205.39.20%20PM.png.png`,

{ invalidate: true, resource_type: "image" },

(err, callResult) => console.log(err, callResult)

);


i have tried to use all combination of publicid .


But still i just get "not found"

Answers

  • Wissam
    Wissam Member, Cloudinary Staff Posts: 103

    Hi @shivam9aug1996 ,

    I have checked your account and indeed there is no resource with the name "uploaded-images/Screenshot 2023-12-31 at 5.39.20 PM.png".

    There is another resource with the name :

    https://res.cloudinary.com/dc2z2c3u8/image/upload/v1704056781/uploaded-images/Screenshot%202023-12-31%20at%205.23.36%20PM.png.png

    Please note that the public ID in this case is

    uploaded-images/Screenshot%202023-12-31%20at%205.23.36%20PM.png

    Note that you don't need to add the following section image/upload/<version> as it is not part of the publicID.

    I hope this is helpful.

    Please let me know how it goes.

    Regards,

    Wissam