{% 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 %}
{% trans "Previous" %}{% trans "Next" %}
{% for image in all_images %}
{% thumbnail image.original "250x400" upscale=False as thumb %}
{% endthumbnail %}
{% endfor %}
{% else %}
{% with image=product.primary_image %}
{% thumbnail image.original "400x400" upscale=False as thumb %}
{% if not image.is_missing %}
{% else %}
{% endif %}
{% endthumbnail %}
{% endwith %}
{% endif %}
{% endwith %}