{% load thumbnail %} {% load i18n %} {% with all_images=product.images.all %} {# use length rather then count as the images get queried anyways #} {% if all_images|length > 1 %} {% else %} {% with image=product.primary_image %} {% thumbnail image.original "400x400" upscale=False as thumb %} {% if not image.is_missing %} image02 {% else %} image02 {% endif %} {% endthumbnail %} {% endwith %} {% endif %} {% endwith %}