{% extends "layout.html" %}
{# ================================================================== #}
{# MACRO QUI GENERE LE TAG PICTURE #}
{# ================================================================== #}
{% macro responsive_image(image_info, alt_text) %}
{% set image_path_prefix = url_for('static', filename='images/') %}
{% set webp_sources = [] %}
{% set png_sources = [] %}
{% for deriv in image_info.derivatives %}
{% if 'webp' in deriv.formats %}{% set _ = webp_sources.append(image_path_prefix + deriv.formats.webp + ' ' + deriv.width ~ 'w') %}{% endif %}
{% if 'png' in deriv.formats %}{% set _ = png_sources.append(image_path_prefix + deriv.formats.png + ' ' + deriv.width ~ 'w') %}{% endif %}
{% endfor %}
{% set webp_srcset = webp_sources | join(', ') %}
{% set png_srcset = png_sources | join(', ') %}
{% set fallback_image = image_info.derivatives[0] if image_info.derivatives else none %}
{% if fallback_image %}
{% set style_str = "aspect-ratio: {} / {};".format(fallback_image.width, fallback_image.height) %}
{{ image_data.base_name }}