Hilton Campbell
Hilton Campbell

Reputation: 6085

Django ImageField that generates multiple renditions

In the admin of my Django website I let admins upload images at a very high resolution. I want to automatically generate and store several renditions of each uploaded image at specific sizes, and then use the different sized renditions in different places on the website.

What is a good way to do this?

Upvotes: 0

Views: 2167

Answers (2)

Hilton Campbell
Hilton Campbell

Reputation: 6085

I ended up using django-imagekit.

Upvotes: 4

user1301404
user1301404

Reputation:

You can use the image directly in your template and use sorl to generate the thumbnail or image at different size.

https://djangosnippets.org/snippets/1172/

You can also override the model save method, check this small script:

https://djangosnippets.org/snippets/1172/

Upvotes: 1

Related Questions