{% set hasMain = false %}
{% if product.imagesByType('main') is not empty %}
{% set hasMain = true %}
{% set source_path = product.imagesByType('main').first.path %}
{% set original_path = source_path|imagine_filter('sylius_shop_product_original') %}
{% set path = source_path|imagine_filter(filter|default('app_shop_product_large_thumbnail')) %}
{% elseif product.images.first %}
{% set source_path = product.images.first.path %}
{% set original_path = source_path|imagine_filter('sylius_shop_product_original') %}
{% set path = source_path|imagine_filter(filter|default('app_shop_product_large_thumbnail')) %}
{% else %}
{% set original_path = 'https://via.placeholder.com/400x300' %}
{% set path = original_path %}
{% endif %}
<div class="gallery d-none d-lg-block">
<div class="row">
<div class="col {% if product.images|length > 1 %}col-md-9{% endif %}">
<a href="{{ original_path }}" class="image" data-lightbox="sylius-product-image">
<img class="main-image" src="{{ path }}" alt="{{ product.name }}">
</a>
</div>
{% if product.images|length > 1 %}
<div class="col-md-3 ">
{{ sylius_template_event('sylius.shop.product.show.before_thumbnails', {'product': product}) }}
<div class="tiny-images">
{% set count = 0 %}
{% for image in product.images %}
{% if (hasMain == true and image.type != 'main') or (hasMain == false and count > 0) %}
{% set path = image.path is not null ? image.path|imagine_filter('sylius_shop_product_small_thumbnail') : '//placehold.it/200x200' %}
<div class="tiny-image-box{% if count > 4 %} d-none{% endif %}">
{#{% if product.isConfigurable() and product.enabledVariants|length > 0 %}
{% include '@SyliusShop/Product/Show/_imageVariants.html.twig' %}
{% endif %}#}
<a class="tiny-link" href="{{ image.path|imagine_filter('sylius_shop_product_original') }}" data-lightbox="sylius-product-image">
<img class="tiny-image" src="{{ path }}" alt="{{ product.name }}">
{% if count > 5 %}<span class="tiny-others-images">+{{ product.images|length - 5 }}</span>{% endif %}
</a>
</div>
{% endif %}
{% set count = count + 1 %}
{% endfor %}
</div>
</div>
{% endif %}
</div>
</div>
<div class="col-xs-10 offset-xs-1 col-sm-8 offset-sm-2">
<div class="splide d-lg-none mb-7">
<div class="splide__track">
<ul class="splide__list">
{% for image in product.images %}
<li class="splide__slide">
<img class="splide-img" src="{{ image.path|imagine_filter('sylius_shop_product_original') }}" alt="{{ product.name }}">
</li>
{% endfor %}
</ul>
</div>
</div>
</div>