django-image-cropping icon indicating copy to clipboard operation
django-image-cropping copied to clipboard

Reduce filesystem work

Open jensenbox opened this issue 12 years ago • 3 comments

So I just started out adding in django-image-cropping on a simple project. All is well aside from a weird chrome anomoly.

I was moving uploaded files around and must have pointed my storage to an invalid location when I went to re-crop and bang, death because it could not read the file.

There are two issues with this, the first is this might happen in production - I would prefer it to either generate a thumbnail or use something like placehold.it. The second and more to the point... why is it hitting the filesystem? (answer: to get the image dimensions) - Would it not be better to just simply cache this data in a field instead of hitting the drive?

So the feature request is - create, or change the definition of the current field to store this extra data.

Thoughts?

jensenbox avatar Sep 16 '12 00:09 jensenbox

That's a good idea! We'd just extend the ImageRatioField to store the image dimensions as well. That would make invalidation after changing an image a lot easier as well - if the dimensions don't match the actual image, we'd just discard the cropping.

Thanks for the suggestion!

jonasvp avatar Sep 17 '12 18:09 jonasvp

I agree, this would be great addition! Please implement it soon.

qwiboo avatar Nov 29 '12 03:11 qwiboo

This hurt us today, because of an amazon DNS issue. But simply rendering should not require to load the object from storage to check size each time.

agfunder avatar Oct 22 '19 20:10 agfunder