diff --git a/app/ap_object.py b/app/ap_object.py index 8cd3660..52061b8 100644 --- a/app/ap_object.py +++ b/app/ap_object.py @@ -275,13 +275,14 @@ 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 resized_url: str | None = None + width: int | None = None + height: int | None = None + @property def mimetype(self) -> str: mimetype = self.media_type diff --git a/app/models.py b/app/models.py index bd0d4ce..391f420 100644 --- a/app/models.py +++ b/app/models.py @@ -251,8 +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, + "width": attachment.upload.width, + "height": attachment.upload.height, "proxiedUrl": url, "resizedUrl": BASE_URL + ( diff --git a/app/templates/utils.html b/app/templates/utils.html index 9f735dd..ddd0af7 100644 --- a/app/templates/utils.html +++ b/app/templates/utils.html @@ -385,7 +385,7 @@ {% for attachment in object.attachments %} {% if attachment.type != "PropertyValue" %} {% set orientation = "unknown" %} - {% if attachment.width > 0 %} + {% if attachment.width %} {% 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"))) %} @@ -394,10 +394,10 @@
-
+
{% else %} -
+
{% endif %} {% if attachment.type == "Image" or (attachment | has_media_type("image")) %}