{% extends 'layout.html.twig' %} {% block body %} {% if author.image is defined %} {{ author.name }} {% endif %}

{% if author.nip05 is defined %} {% if author.nip05 is iterable %} {% for nip05Value in author.nip05 %} {% endfor %} {% else %} {% endif %} {% endif %}
{% if author.about is defined %} {{ author.about|markdown_to_html|mentionify|linkify }} {% endif %}
Articles Media {% if is_granted('ROLE_ADMIN') %} About {% endif %}
{% if pictureEvents|length > 0 %}
{% for event in pictureEvents %}
{# Extract title #} {% set title = null %} {% for tag in event.tags %} {% if tag[0] == 'title' %} {% set title = tag[1] %} {% endif %} {% endfor %} {# Extract first image from imeta tags #} {% set firstImageUrl = null %} {% set firstVideoUrl = null %} {% set imageAlt = null %} {% set isVideo = false %} {% for tag in event.tags %} {% if tag[0] == 'imeta' %} {% set videoUrl = null %} {% set imageUrl = null %} {% set previewImage = null %} {% for i in 1..(tag|length - 1) %} {% set param = tag[i] %} {% if param starts with 'url ' %} {% set potentialUrl = param[4:] %} {# Check if it's a video URL #} {% if potentialUrl matches '/\\.(mp4|webm|ogg|mov)$/i' or potentialUrl matches '/video/i' %} {% set videoUrl = potentialUrl %} {% set isVideo = true %} {% else %} {% set imageUrl = potentialUrl %} {% endif %} {% elseif param starts with 'image ' %} {# Preview/poster image for video or regular image #} {% set previewImage = param[6:] %} {% elseif param starts with 'alt ' %} {% set imageAlt = param[4:] %} {% endif %} {% endfor %} {# Set the first video and image found #} {% if videoUrl and firstVideoUrl is null %} {% set firstVideoUrl = videoUrl %} {# Use preview image if available, otherwise try to use the main image URL #} {% if previewImage and firstImageUrl is null %} {% set firstImageUrl = previewImage %} {% elseif imageUrl and firstImageUrl is null %} {% set firstImageUrl = imageUrl %} {% endif %} {% endif %} {# For non-video items, use the image URL or preview #} {% if not videoUrl and firstImageUrl is null %} {% if imageUrl %} {% set firstImageUrl = imageUrl %} {% elseif previewImage %} {% set firstImageUrl = previewImage %} {% endif %} {% endif %} {% endif %} {% endfor %} {# Generate nevent for linking #} {% set eventId = event.id %} {% set noteId = event.noteId %} {% if firstImageUrl %}
{{ imageAlt|default(title|default(isVideo ? 'Video' : 'Picture')) }} {% if isVideo %}
{% endif %} {% if event.content %}
{% if event.content %}

{{ event.content|length > 100 ? event.content[:100] ~ '...' : event.content }}

{% endif %}
{% endif %}
{% elseif isVideo %} {# Video without preview image - show placeholder with video icon #}
{% if event.content %}
{% if event.content %}

{{ event.content|length > 100 ? event.content[:100] ~ '...' : event.content }}

{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{% if hasMore %}

Showing {{ pictureEvents|length }} of {{ total }} media items

{% endif %}
{% else %}

No media found for this author.

{% endif %}
{% endblock %}