SmileyChris / easy-thumbnails

Easy thumbnails for Django
http://easy-thumbnails.readthedocs.org/
BSD 3-Clause "New" or "Revised" License
1.39k stars 319 forks source link

Django Cropping - Duplicates in DB and File Storage #477

Open python-force opened 7 years ago

python-force commented 7 years ago

Why is Easy Thumbnails when you change in Admin the resizing rectangle creating new files and also in DB. Basically, if you keep changing that rectangle your DB is getting bigger and file storage is filling up with files which are not used anymore.

Here is an example Old Value of Cropping: 50, 0, 1205, 833 New Value of Cropping: 0, 0, 1155, 833

Now in my file storage have files that are not used anymore. Images with "50, 0, 1205, 833" will be sitting there forever and also in DB look at the screenshots.

It should be done:

If images exist delete them and create new with "0, 0, 1155, 833" cropping and also in DB the values should be changed for the same image source "50, 0, 1205, 833" to "0, 0, 1155, 833".

If cropping value can change in the Admin for the image and there is no other filed for old value then table easy_thumbnails_thumbnail can do that also rewriting the data not make duplicates.

django-cropping django-cropping2 django-cropping3