New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cached formatted Images not deleted when image file renamed #3045
Comments
@sheadawson This would probably solve silverstripe/silverstripe-cms#997 too. Sounds like the same issue. |
I would be careful of changing the data fields during an onbeforewrite, but the methodology seems ok. Maybe clone the object just to be safe. You should also take into consideration that the file may be moved to another parent directory. |
Both excellent points @tractorcow |
This is taken care of in 4.x. On move / rename, all variants are also moved. |
@tractorcow did your recent patch cause any regressions in this regard? |
In 4.x if you rename a file, all variants are renamed at the same time. |
A bit of an edge case, but there is an issue where, for example - If I upload 2 images, image-1.jpg and image-2.jpg... and then renamed image-1.jpg to image-1a.jpg, and renamed image-2.jpg to "image-1.jpg", any resampled image-1.jpg images with the same resampling method and sizes will refer to a cached version of the original image-1.jpg, which is actually a different image.
A possible solution for this would be to deleteFormattedImages when an image file is renamed. Here's an extension I wrote to get around it
The text was updated successfully, but these errors were encountered: