Closed webwinners closed 3 years ago
Assuming that object.manufacturer.photo
is of type filer.models.imagemodels.Image
, then this approach may work for you:
{% load thumbnail %}
{% thumbnail object.manufacturer.photo 96x96 crop as thumb %}
{% thumbnail object.manufacturer.photo 192x192 crop as thumb2x %}
<img class="img" srcset="{{ thumb2x.url }} 2x" src="{{ thumb.url }}">
The option THUMBNAIL_HIGH_RESOLUTION
and THUMBNAIL_HIGHRES_INFIX
have been added at a time, when the srcset
option was not available in most browsers. At that time (~2012), we had to use a JavaScript hack, for instance retina.js, which checked if the image was available in high resolution. Fortunately nowadays all browsers evaluate the underlying screen resolution and load the appropriate image.
I have problem with high resolution photos, and displaing it on my themplate. I don't see any function that return 2x photo, generated automatically when other thumbnails are created.
1x photo, like this: template: