{% load wagtailcore_tags %} {% load wagtailimages_tags %} {% load common_tags %} {% spaceless %} {% with len=self.images|length %}
{% for image in self.images %}
{% if self.open_large %} {% if image.image.stream_data.0 %} {% else %} {% image image.image max-1500x1500 as large_image %} {# The caption is likely pretty long if using side-text, don't show it in lightbox #} {% endif %} {% endif %} {# Gallery, crop images and make the first larger. #} {% if self.layout == "gallery" %} {% if forloop.counter0 < 2 %} {# TODO: Create helper for stream block logic #} {% if image.image.stream_data.0 %} {% if image.image.stream_data.0.type == "svg" or image.image.stream_data.0.0 == "svg" %} {{ image.image }} {% else %} {% image image.image.0.value fill-600x400 %} {% endif %} {% else %} {% image image.image fill-600x400 %} {% endif %} {% else %} {% if image.image.stream_data.0 %} {% if image.image.stream_data.0.type == "svg" or image.image.stream_data.0.0 == "svg" %} {{ image.image }} {% else %} {% image image.image.0.value fill-200x130 %} {% endif %} {% else %} {% image image.image fill-200x130 %} {% endif %} {% endif %} {# Two columns (of images or image + text), resize to width. #} {% elif self.layout == "cols-2" or self.layout == "side-text" %} {% if image.image.stream_data.0 %} {% if image.image.stream_data.0.type == "svg" or image.image.stream_data.0.0 == "svg" %} {{ image.image }} {% else %} {% image image.image.0.value width-600 %} {% endif %} {% else %} {% image image.image width-600 %} {% endif %} {# Single column, resize to width. #} {% else %} {% if image.image.stream_data.0 %} {% if image.image.stream_data.0.type == "svg" or image.image.stream_data.0.0 == "svg" %} {{ image.image }} {% else %} {% image image.image.0.value width-1000 %} {% endif %} {% else %} {% image image.image width-1000 %} {% endif %} {% endif %} {% if self.open_large %} {% endif %}
{# Only show caption in gallery for the larger images #} {% if self.layout != "gallery" or forloop.counter0 < 2 %} {% if image.caption.source|striptags %}
{{ image.caption }}
{% endif %} {% endif %}
{% endfor %}
{% endwith %} {% endspaceless %}