From d02408ceb14b377a1f6c426b4f8a4c0b060ab036 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nu=C5=A1a=20Puk=C5=A1i=C4=8D?= Date: Sun, 12 Oct 2025 12:48:39 +0200 Subject: [PATCH] Image gallery fix --- templates/event/index.html.twig | 138 ++++++++++++++++---------------- 1 file changed, 69 insertions(+), 69 deletions(-) diff --git a/templates/event/index.html.twig b/templates/event/index.html.twig index aaffd12..b3a81df 100644 --- a/templates/event/index.html.twig +++ b/templates/event/index.html.twig @@ -120,61 +120,59 @@
- {% endif %} - - {# Collect all imeta images into an array #} - {% set images = [] %} - {% for tag in event.tags %} - {% if tag[0] == 'imeta' %} - {% set imageUrl = null %} - {% set mimeType = null %} - {% set blurhash = null %} - {% set dimensions = null %} - {% set altText = null %} - {% set fallbacks = [] %} - {% set annotatedUsers = [] %} - {# Parse imeta tag parameters #} - {% for i in 1..(tag|length - 1) %} - {% set param = tag[i] %} - {% if param starts with 'url ' %} - {% set imageUrl = param[4:] %} - {% elseif param starts with 'm ' %} - {% set mimeType = param[2:] %} - {% elseif param starts with 'blurhash ' %} - {% set blurhash = param[9:] %} - {% elseif param starts with 'dim ' %} - {% set dimensions = param[4:] %} - {% elseif param starts with 'alt ' %} - {% set altText = param[4:] %} - {% elseif param starts with 'fallback ' %} - {% set fallbacks = fallbacks|merge([param[9:]]) %} - {% elseif param starts with 'annotate-user ' %} - {% set annotatedUsers = annotatedUsers|merge([param[14:]]) %} - {% endif %} - {% endfor %} - {# Alt is also own tag #} - {% for altTag in event.tags %} - {% if altTag[0] == 'alt' %} - {% set altText = altTag[1] %} - {% endif %} - {% endfor %} - {% set images = images|merge([{ - 'url': imageUrl, - 'mimeType': mimeType, - 'blurhash': blurhash, - 'dimensions': dimensions, - 'altText': altText, - 'fallbacks': fallbacks, - 'annotatedUsers': annotatedUsers - }]) %} - {% endif %} - {% endfor %} + {# Collect all imeta images into an array #} + {% set images = [] %} + {% for tag in event.tags %} + {% if tag[0] == 'imeta' %} + {% set imageUrl = null %} + {% set mimeType = null %} + {% set blurhash = null %} + {% set dimensions = null %} + {% set altText = null %} + {% set fallbacks = [] %} + {% set annotatedUsers = [] %} + {# Parse imeta tag parameters #} + {% for i in 1..(tag|length - 1) %} + {% set param = tag[i] %} + {% if param starts with 'url ' %} + {% set imageUrl = param[4:] %} + {% elseif param starts with 'm ' %} + {% set mimeType = param[2:] %} + {% elseif param starts with 'blurhash ' %} + {% set blurhash = param[9:] %} + {% elseif param starts with 'dim ' %} + {% set dimensions = param[4:] %} + {% elseif param starts with 'alt ' %} + {% set altText = param[4:] %} + {% elseif param starts with 'fallback ' %} + {% set fallbacks = fallbacks|merge([param[9:]]) %} + {% elseif param starts with 'annotate-user ' %} + {% set annotatedUsers = annotatedUsers|merge([param[14:]]) %} + {% endif %} + {% endfor %} + {# Alt is also own tag #} + {% for altTag in event.tags %} + {% if altTag[0] == 'alt' %} + {% set altText = altTag[1] %} + {% endif %} + {% endfor %} + {% set images = images|merge([{ + 'url': imageUrl, + 'mimeType': mimeType, + 'blurhash': blurhash, + 'dimensions': dimensions, + 'altText': altText, + 'fallbacks': fallbacks, + 'annotatedUsers': annotatedUsers + }]) %} + {% endif %} + {% endfor %} - {% if images|length > 0 %} - - + {% endif %} + {% endif %}