{% load thumbnail l10n %}{% spaceless %}

<picture {{ instance.html_tag_attributes }}>
{% for elem in elements %}
	{% thumbnail instance.image elem.size zoom=elem.zoom crop=elem.crop upscale=elem.upscale subject_location=elem.subject_location as thumb %}
	{% if elem.size2 %}
		{% thumbnail instance.image elem.size2 zoom=elem.zoom crop=elem.crop upscale=elem.upscale subject_location=elem.subject_location as thumb2 %}
	{% endif %}
	{% if elem.tag == "source" %}
	<source srcset="{{ thumb.url }}{% if thumb2 %} 1x, {{ thumb2.url }} 2x{% endif %}" media="{{ elem.media }}" />
	{% elif elem.tag == "img" %}
	<img src="{{ thumb.url }}" class="{{ instance.css_classes }}"{% if not is_fluid %} width="{{ thumb.width|unlocalize }}" height="{{ thumb.height|unlocalize }}"{% endif %} />
	{% endif %}
{% endfor %}
</picture>

{% endspaceless %}