5👍
✅
Why don’t you try sorl-thumbnail. It has the exact same interface as the default ImageField django provides and it seems like it would be a lot nicer to work with than the roll-your-own support.
- Storage support
- Pluggable Engine support (PIL, pgmagick)
- Pluggable Key Value Store support (redis, cached db)
- Pluggable Backend support
- Admin integration with possibility to delete
- Dummy generation
- Flexible, simple syntax, generates no html
- ImageField for model that deletes thumbnails
- CSS style cropping options
- Margin calculation for vertical positioning
7👍
I had a similar problem, but in my case using sorl-thumbnail was not an option. I found that I can open an Image directly from S3BotoStorage by passing in a file descriptor instead of a path.
So instead of
thumb = Image.open(self.image.path)
use
thumb = Image.open(s3_storage.open(self.image.name))
Then you can process and save the new file locally as you were doing before.
- [Django]-Django: object needs to have a value for field "…" before this many-to-many relationship can be used
- [Django]-In stripe checkout page display Country or region fields how to remove it
- [Django]-How can I do AND lookups with Q objects when using repeated arguments instead of chaining filters?
Source:stackexchange.com