Hello everyone,
I’m currently working on a project using Strapi with GraphQL and Cloudinary for media management. I’ve encountered an issue that I hope someone can help me with.
When I create a product in Strapi and upload an image to Cloudinary, everything works perfectly. However, when I edit the product and upload a new image, the old image remains in Cloudinary and is not deleted. This accumulation of old images is causing storage issues and unnecessary costs.
Here are the steps I’m currently taking:
- I upload the new image using the Cloudinary upload function.
- I do not have any mechanism in place to delete the old image from Cloudinary before or after uploading the new one.
I’d like to know:
- Is there a recommended approach to automatically delete the old image when a new image is uploaded?
- Are there any best practices for managing images in Cloudinary when using Strapi?
- Should I keep track of the public ID of the old image to facilitate its deletion, and if so, how can I implement this effectively?
Any insights, examples, or suggestions would be greatly appreciated!
Thank you in advance for your help!