{# in diesen Routes werden die webp-Grafiken nicht verwendet (PP-Previews) #}
{% set except_webp_routes = [
'frontend.checkout.cart.page',
'frontend.checkout.finish.page',
'frontend.checkout.confirm.page',
'frontend.checkout.register.page',
'frontend.account.edit-order.page',
'frontend.wishlist.page',
'km.ticket.form'
] %}
{% if activeRoute in except_webp_routes %}
{% sw_include '@KmPritchPrint/storefront/utilities/thumbnail-km-pp.html.twig' with {
media: media
}%}
{% else %}
{% block thumbnail_utility %}{% apply spaceless %}
{% if attributes is not defined %}
{% set attributes = {} %}
{% endif %}
{% if attributes.class %}
{% set attributes = attributes|merge({'class': 'weedesign-webp ' ~ attributes.class}) %}
{% else %}
{% set attributes = attributes|merge({'class': 'weedesign-webp'}) %}
{% endif %}
{% if attributes.alt is not defined and media.translated.alt is defined %}
{% set attributes = attributes|merge({'alt': media.translated.alt}) %}
{% endif %}
{% if attributes.title is not defined and media.translated.title is defined %}
{% set attributes = attributes|merge({'title': media.translated.title}) %}
{% endif %}
{% set metaProportion = media.metaData %}
{% if media.thumbnails|length > 0 %}
{% if minSize > 0 %} {# Die Slider wurden unscharf angezeigt, weil Höhe zu gering. minSize wird in cms-element-solid-ase-content-slider.html.twig gesetzt #}
{% set thumbnails = media.thumbnails|filter((v) => v.width <= metaProportion.width && v.width > minSize )|sort((a, b) => a.width <=> b.width)|reverse %}
{% else %}
{% set thumbnails = media.thumbnails|filter((v) => v.width <= metaProportion.width )|sort((a, b) => a.width <=> b.width)|reverse %}
{% endif %}
{% if thumbnails %}
{% set srcsetValue %}{% apply spaceless %}
{{ media|weedesign_images2webp_webp_url_media }} {{ thumbnails|first.width + 1 }}w,
{% for thumbnail in thumbnails %}
{{ thumbnail|weedesign_images2webp_webp_url_thumbnail }} {{ thumbnail.width - 10 }}w{% if not loop.last %}, {% endif %}
{% endfor %}
{% endapply %}{% endset %}
{% endif %}
{% endif %}
{% set ratio = metaProportion.width ~ '/' ~ metaProportion.height %}
{% set inlineStyle = "aspect-ratio:" ~ ratio ~ ";" %}
{% if attributes.style %}
{% set attributes = attributes|merge({'style': inlineStyle ~ attributes.style}) %}
{% else %}
{% set attributes = attributes|merge({'style': inlineStyle}) %}
{% endif %}
{% block thumbnail_utility_img %}
{% set src = media|weedesign_images2webp_webp_url_media %}
<img src="{{ src }}"
{% if srcsetValue != "" %}
srcset="{{ srcsetValue }}"
{% endif %}
{% for key, value in attributes %}
{{ key }}="{{ value }}"
{% if key == 'itemprop' %}
content="{{ media|weedesign_images2webp_webp_url_media }}"
{% endif %}
{% endfor %}
/>
{% endblock %}
{% endapply %}{% endblock %}
{% endif %}