matthewwithanm / django-imagekit

Automated image processing for Django. Currently v4.0
http://django-imagekit.rtfd.org/
BSD 3-Clause "New" or "Revised" License
2.24k stars 276 forks source link

Make it possible to generate srcset with the thumbnail template tag #575

Open autoantwort opened 2 weeks ago

autoantwort commented 2 weeks ago

Instead of

{% thumbnail 'x400' image.image as img %}
{% thumbnail 'x800' image.image as img2 %}
{% thumbnail 'x1200' image.image as img3 %}
    <img src="{{ img.url }}"
         srcset="{{ img.url }}, {{ img2.url }} 2x, {{ img3.url }} 3x"
         height="{{ img.height }}" width="{{ img.width }}">

one can write

{% thumbnail 'x400' bar.image srcset="2 3" %}
vstoykov commented 2 weeks ago

Thank you @autoantwort for your contribution. Can I ask you to add simple test that is rendering the template tag and observe the output of it?