syamilmj / Aqua-Resizer

Resize WordPress images on the fly
502 stars 208 forks source link

Deleting images from WP Admin #20

Open JohnBuchmann opened 11 years ago

JohnBuchmann commented 11 years ago

We're finding that when images are being deleted via WP admin, some of the resized image files are also deleted, but others are being left in the uploads folder. Then, if a new image with the same filename is uploaded, the resized files that Aqua Resizer creates are given filenames that have a number suffix included, and when the image needs to be shown on the website, the wrong one is appearing.

For example:

An image called "steve-i-phone-021.jpg" is uploaded. Various resized versions are created, including "steve-i-phone-021-700x350.jpg". That image is deleted via WP admin, and most of the resized images are also deleted, but "steve-i-phone-021-700x350.jpg" is NOT deleted, and it stays in the uploads folder. A different image which has the same name "steve-i-phone-021.jpg" is now uploaded. Various resized versions are created, but the one for 700x350px is given the name "steve-i-phone-0211-700x350.jpg" because "steve-i-phone-021-700x350.jpg" already exists (note the extra "1" in the filename). Now, when the 700x350px version needs to be shown on the website, Aqua Resizer is showing the original "steve-i-phone-021-700x350.jpg", i.e. the old image which is the wrong one, that should have been deleted.