delete images not in public_id list
Hey all,
I'm developing an app where users can upload an image which will be stored in cloudinary and updating the dabatase with the public_id once it's done. Obviously, errors can happen, creating some inconsistency between the database and Cloudindary (100 records in the database, 130 images in cloudinary, for example).
Is there a way of performing a cleanup of some sort, where I pass a list of public_ids and tell cloudinary to delete all images that are not in this list?
-
Hi Yaniv,
Thank you for contacting us.
You can write a script that performs the cleanup by using our destroy method via the API. You can read more about how to perform deletion on the following link- https://cloudinary.com/documentation/node_image_upload#update_and_delete_images
Hope this helps, please let me know if you have any further questions.
Thanks,
Raya
Please sign in to leave a comment.
Comments
1 comment