syamilmj / Aqua-Resizer

Resize WordPress images on the fly
500 stars 204 forks source link

Resized images not deleted on deleting original image in wp-admin #115

Open rmens opened 4 years ago

rmens commented 4 years ago

When an image is deleted via the wp-admin media library, all the sizes generated by WordPress are deleted, but not the sizes generated by the Aqua-Resizer. This leaves a whole lot of junk on the filesystem.

Is it possible to make a function that hooks into wp_delete_attachment to let Aqua-Resizer cleanup after itself?

awps commented 4 years ago

This library generates images on the fly and does not save its data in DB. So deleting the files from the uploads folder may be risky if not done correctly.

rmens commented 4 years ago

I see. There is limited data to work with, but I'm thinking of:

adityathok commented 4 years ago

I tried it with this, and it worked. but only for file names that have been saved

https://github.com/syamilmj/Aqua-Resizer/pull/118/commits/707cb1a8e7bdb7c10072577b69bba6db482a276b

bsgdigital commented 4 years ago

I've made a PR for this quite some time ago https://github.com/syamilmj/Aqua-Resizer/pull/112 - it updates attachment metadata with the new sizes, so WP is aware of them and deletes when needed

rmens commented 1 year ago

Can that PR be merged please @syamilmj?