Reputation: 11
I use google cloud storage as my CKEditor image uploader.
But now I face some problems. If I upload a image to GCS, then I delete the image in my article, that image still exist in my GCS.
Can GCS auto delete unused image?
Upvotes: 0
Views: 1722
Reputation: 12145
It sounds like the condition you want is that there are no img tag references in your HTML files to an image file you want to delete. If that's the case, Lifecycle Management has no condition support for that condition. Or maybe you're thinking of deleting images if they haven't been accessed in the past N days. Unfortunately that also is not a condition supported by Lifecycle Management.
If the above is a correct interpretation of your case, you will need to implement something to do the needed detection - either by walking your HTML objects and determining which of your image files is no longer referenced, or by enabling object access logging and walking the logs to determine image files that haven't been accessed recently.
Upvotes: 1
Reputation: 1420
You can set up a GCS Object Lifecycle rule that would delete images based on conditions you choose.
Upvotes: 0