diff --git a/app/ap_object.py b/app/ap_object.py index 788d267..8cd3660 100644 --- a/app/ap_object.py +++ b/app/ap_object.py @@ -275,6 +275,8 @@ class Attachment(BaseModel): media_type: str | None name: str | None url: str + width: int + height: int # Extra fields for the templates (and only for media) proxied_url: str | None = None diff --git a/app/models.py b/app/models.py index 30fcedb..bd0d4ce 100644 --- a/app/models.py +++ b/app/models.py @@ -251,6 +251,8 @@ class OutboxObject(Base, BaseObject): "mediaType": attachment.upload.content_type, "name": attachment.alt or attachment.filename, "url": url, + "width":attachment.width, + "height":attachment.height, "proxiedUrl": url, "resizedUrl": BASE_URL + ( diff --git a/app/templates/utils.html b/app/templates/utils.html index 7a33730..9f735dd 100644 --- a/app/templates/utils.html +++ b/app/templates/utils.html @@ -384,16 +384,20 @@ {% for attachment in object.attachments %} {% if attachment.type != "PropertyValue" %} + {% set orientation = "unknown" %} + {% if attachment.width > 0 %} + {% set orientation = "portrait" if attachment.width < attachment.height else "landscape" %} + {% endif %} {% if object.sensitive and (attachment.type == "Image" or (attachment | has_media_type("image")) or attachment.type == "Video" or (attachment | has_media_type("video"))) %}
-
+
{% else %} -
+
{% endif %} {% if attachment.type == "Image" or (attachment | has_media_type("image")) %}