Representing images

For example an image with a description uploaded to Pleroma will look like this (and what it will look like in AP C2S because we transform every object):

{
  "mediaType": "image/jpeg",
  "name": "screenshot_mpv:Doctor Who (2005) - S07E06 - The Bells of St John (1080p BluRay x265 Panda)@00:00:42.000.jpg",
  "type": "Document",
  "url": "https://queer.hacktivis.me/media/6992382f-4bd0-4fc7-8a8d-362da615b19a/screenshot_mpv%3ADoctor%20Who%20%282005%29%20-%20S07E06%20-%20The%20Bells%20of%20St%20John%20%281080p%20BluRay%20x265%20Panda%29%4000%3A00%3A42.000.jpg"
}

And for Mastodon:

{
  "type": "Document",
  "mediaType": "image/png",
  "url": "https://files.mastodon.social/media_attachments/files/027/702/471/original/a770e4155dae9cad.png",
  "name": "a new flat and modern logo showing a blue-light blue sengi",
  "blurhash": "Uq0|dqf}Zeg5f_e.etf+d;e?f,e,etfkg1f7"
}

(blurhash is mastodon own thing to get blurry thumbnails, for example as a removable overlay on sensitive activities)

But the different ways of representing objects in ActivityPub doesn’t matters so much, most implementations will tend to copy what others are doing and otherwise use similar logic between each others (I think yours is similar to videos in Peertube).

I don’t want to develop my application to handle every possible representation it might encounter; I’d rather use my finite time for developing features that will actually be used. At the same point, I’d like to strike a reasonable balance of interoperability. The specification is so wide open as to be nearly useless in deciding what formats one should expect to support.

One way you could do is to look at what others have, for example the relevant part in pleroma is:

And for the AP client, I think having a subset of ActivityPub like Pleroma does could be a good idea to avoid having to do so much code (also you should validate external data, having transformation of it makes it easier). We should probably have it documented at some point to help AP C2S clients so feel free to ask for it.

One thing which might be interesting to you for the AP C2S side of things is the uploadMedia endpoint, which we have added in Pleroma with AndStatus (client): ActivityPub C2S: How to upload images?

3 Likes