{% if product.imagesByType('thumbnail') is not empty %}
{% set originalPath = product.imagesByType('thumbnail').first.path %}
{% set path = product.imagesByType('thumbnail').first.path|imagine_filter(filter|default('sylius_shop_product_thumbnail')) %}
{% set final_path_webp = originalPath|imagine_filter('my_thumb_webp') %}
{% elseif product.images.first %}
{% set originalPath = product.images.first.path %}
{% set path = product.images.first.path|imagine_filter(filter|default('sylius_shop_product_thumbnail')) %}
{% set final_path_webp = originalPath|imagine_filter('my_thumb_webp') %}
{% else %}
{% set originalPath = asset('assets/shop/img/placeholder_max.jpg') %}
{% set path = asset('assets/shop/img/placeholder_max.jpg') %}
{% set final_path_webp = originalPath %}
{% endif %}
{% set bordered = bordered ?? true %}
<picture>
{% if app.environment == "prod" %}
<source id="{{product.id}}_pic_src_1" srcset="{{ final_path_webp }}" type="image/webp">
<source id="{{product.id}}_pic_src_2" srcset="{{ path }}" type="image/jpeg">
<img width="200px" height="200px" style="width:100% !important; height: auto !important;" src="{{ path }}" alt="{{ product.name }}" class="ui {% if bordered %}bordered{% endif %} image" onerror="this.src='{{ path }}';document.getElementById('{{product.id}}_pic_src_1').srcset=document.getElementById('{{product.id}}_pic_src_2').srcset=this.src;this.onerror=null;">
{% else %}
<source id="{{product.id}}_pic_src_1" srcset="{{ final_path_webp }}" type="image/webp">
<source id="{{product.id}}_pic_src_2" srcset="{{ path }}" type="image/jpeg">
<img width="200px" height="200px" style="width:100% !important; height: auto !important;" src="{{ path }}" alt="{{ product.name }}" class="ui {% if bordered %}bordered{% endif %} image" onerror="this.src='{{path}}';document.getElementById('{{product.id}}_pic_src_1').srcset=document.getElementById('{{product.id}}_pic_src_2').srcset=this.src;this.onerror=null;">
{% endif %}
{# <img src="{{ path }}" {{ sylius_test_html_attribute('main-image') }} alt="{{ product.name }}" class="ui bordered image" /> #}
</picture>