Skip to content

[feature] Include width and height properties in ActivityPub for image attachments #17562

@broadwaylamb

Description

@broadwaylamb

Summary

Mastodon includes the width and height properties in the ActivityPub representation of image attachments.

For example, the image in this toot is represented like this:

{
  "type": "Document",
  "mediaType": "image/png",
  "url": "https://files.mastodon.social/media_attachments/files/116/614/866/422/305/225/original/00a9a8be3d4227b3.png",
  "name": null,
  "blurhash": "U56[viSc4Ut7?@bXV[oMM|t6t6Rk4oxbt7Rj",
  "width": 3600,
  "height": 1890
}

I'm proposing that Misskey does the same.

Purpose

Image attachments from Misskey posts don't have any size information in ActivityPub. Because of this, other ActivityPub software can have issues when laying out such posts in its client GUI.

For example, Smithereen uses a special algorithm that lays out post attachments in a nice grid (example). However, this algorithm requires that we know the aspect ratio of each image. If we don't know it, then it will lay out images as if they were squares. When actual images are fetched (and we know their sizes), they have to be layed out again. This results in worse user experience than it could be.

Do you want to implement this feature yourself?

  • Yes, I will implement this by myself and send a pull request

Metadata

Metadata

Assignees

Labels

✨FeatureThis adds/improves/enhances a feature🌌FederationThe Federation/ActivityPub feature

Type

No type
No fields configured for issues without a type.

Projects

Status
Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions