Open
Description
I am uploading images, and rather than create thumbnails dynamically via a template tag, I want to create the necessary thumbnails when the upload is done. This should essentially mirror what the template tag would do. So where:
{% thumbnail object.user.address.address_img "240" crop="center" as im %}
<img itemprop="image"
src="{{ im.url }}"
alt="{{ object.display_name }}"
title="{{ object.display_name }}"
width="{{ im.width }}"
height="{{ im.height }}"
class="page-img"/>
{% endthumbnail %}
I would like to leave that code on the template, but pre-generate the thumbnail in the view:
th_img = get_thumbnail(object.user.address.address_img, '240', crop='center')
th_img
has properties key
, name
, url
, etc, but no file is created in the cache, and there is no entry in the thumbnail_kvstore
.
How do I "save" the thumbnail and get an entry in the thumbnail_kvstore
?
The thumbnail cannot go into a field for the model, because there are other sizes of thumbnail to be generated too.
Thanks
Metadata
Assignees
Labels
No labels