<div id="product-image">
{% if product.imagesByType('main') is not empty %}
{% 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('my_original_webp') %} #}
{% set final_path = source_path|imagine_filter(filter|default('sylius_shop_product_original')) %}
{% set final_path_webp = source_path|imagine_filter('my_original_webp') %}
{% 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('sylius_shop_product_original')) %} #}
{% set final_path = source_path|imagine_filter(filter|default('sylius_shop_product_original')) %}
{% set final_path_webp = source_path|imagine_filter('my_original_webp') %}
{% else %}
{% set original_path = asset('assets/shop/img/400x300.png') %}
{# {% set path = original_path %} #}
{% set final_path_webp = original_path %}
{% set final_path = original_path %}
{% endif %}
{% set taxon = product.mainTaxon %}
<div data-product-image="{{ final_path }}" data-product-link="{{ final_path }}"></div>
{# {{ dump(source_path|imagine_filter('my_thumb_webp')) }} #}
{% if taxon.slug == 'gift-cards' %}
<div class="ui fluid image">
<picture>
{% if app.environment == "prod" %}
<source id="picture_source_1" type="image/webp" data-original="{{ final_path_webp }}" srcset="{{ final_path_webp }}">
<source id="picture_source_2" type="image/jpeg" data-original="{{ final_path }}" srcset="{{ final_path }}">
<img width="200px" height="200px" style="width:100% !important; height: auto !important;" src="{{ final_path }}" id="main-image" alt="{{ product.name }}" {{ sylius_test_html_attribute('main-image') }} onerror="this.src='{{ final_path }}';document.getElementById('picture_source_1').srcset=document.getElementById('picture_source_2').srcset=this.src;this.onerror=null;">
{% else %}
<source id="picture_source_1" type="image/webp" data-original="{{ final_path_webp }}" srcset="{{ final_path_webp }}">
<source id="picture_source_2" type="image/jpeg" data-original="{{ final_path }}" srcset="{{ final_path }}">
<img width="200px" height="200px" style="width:100% !important; height: auto !important;" src="{{ final_path }}" id="main-image" alt="{{ product.name }}" {{ sylius_test_html_attribute('main-image') }} onerror="this.src='{{ final_path }}';document.getElementById('picture_source_1').srcset=document.getElementById('picture_source_2').srcset=this.src;this.onerror=null;">
{% endif %}
{# <img src="{{ path }}" id="main-image" alt="{{ product.name }}" {{ sylius_test_html_attribute('main-image') }} /> #}
</picture>
</div>
{% else %}
<a href="{{ final_path }}" class="ui fluid image --" data-lightbox="sylius-product-image">
<picture>
{# <source type="image/webp" data-original="{{ source_path }}" srcset="{{ source_path | imagine_filter(filter|default('sylius_shop_product_original')) ~ '.webp' | replace({"/resolve"}) }}"> #}
{% if app.environment == "prod" %}
<source id="picture_source_1" type="image/webp" data-original="{{ final_path_webp }}" srcset="{{ final_path_webp }}">
<source id="picture_source_2" type="image/jpeg" data-original="{{ final_path }}" srcset="{{ final_path }}">
<img width="200px" height="200px" style="width:100% !important; height: auto !important;" src="{{ final_path }}" id="main-image" alt="{{ product.name }}" {{ sylius_test_html_attribute('main-image') }} onerror="this.src='{{ final_path }}';document.getElementById('picture_source_1').srcset=document.getElementById('picture_source_2').srcset=this.src;this.onerror=null;">
{% else %}
<source id="picture_source_1" type="image/webp" data-original="{{ final_path_webp }}" srcset="{{ final_path_webp }}">
<source id="picture_source_2" type="image/jpeg" data-original="{{ final_path }}" srcset="{{ final_path }}">
<img width="200px" height="200px" style="width:100% !important; height: auto !important;" src="{{ final_path }}" id="main-image" alt="{{ product.name }}" {{ sylius_test_html_attribute('main-image') }} onerror="this.src='{{ final_path }}';document.getElementById('picture_source_1').srcset=document.getElementById('picture_source_2').srcset=this.src;this.onerror=null;">
{% endif %}
</picture>
{# <img src="{{ path }}" id="main-image" alt="{{ product.name }}" {{ sylius_test_html_attribute('main-image') }} /> #}
</a>
{% endif %}
{% if product.images|length > 1 %}
<div class="ui hidden divider"></div>
{{ sylius_template_event('sylius.shop.product.show.before_thumbnails', {'product': product}) }}
<div class="owl-carousel images">
{% for image in product.images %}
{% set path = image.path is not null ? image.path|imagine_filter('sylius_shop_product_small_thumbnail') : asset('assets/shop/img/200x200.png') %}
<div class="item">
{% if product.isConfigurable() and product.enabledVariants|length > 0 %}
{% include '@SyliusShop/Product/Show/_imageVariants.html.twig' %}
{% endif %}
<a href="{{ image.path|imagine_filter('sylius_shop_product_original') }}" data-lightbox="sylius-product-image">
<img width="200px" height="200px" style="width:100% !important; height: auto !important;" src="{{ path }}" data-large-thumbnail="{{ image.path|imagine_filter('sylius_shop_product_large_thumbnail') }}" alt="{{ product.name }}" />
</a>
</div>
{% endfor %}
</div>
{% endif %}
</div>