themes/BootstrapChildTheme/SyliusShopBundle/views/Product/_mainImage.html.twig line 1

Open in your IDE?
  1. {% set images = product.imagesByType('main') %}
  2. {% if images|length %}
  3.     {% set path = images.first.path | imagine_filter(filter|default('app_shop_product_thumbnail')) %}
  4.     {% set pathSmall = images.first.path | imagine_filter(filter|default('app_shop_product_tiny_thumbnail')) %}
  5. {% elseif product.images.first %}
  6.     {% set path = product.images.first.path | imagine_filter(filter|default('app_shop_product_thumbnail')) %}
  7.     {% set pathSmall = product.images.first.path | imagine_filter(filter|default('app_shop_product_tiny_thumbnail')) %}
  8. {% else %}
  9.     {% set path = 'https://via.placeholder.com/260x260' %}
  10.     {% set pathSmall = 'https://via.placeholder.com/260x260' %}
  11. {% endif %}
  12. <img class="lazy product-img img-fluid w-100" src="{{ pathSmall }}" data-src="{{ path }}" {{ sylius_test_html_attribute('main-image') }} alt="{{ product.name }}">