Page MenuHomeMusing Studio

Include images as attachments in ActivityStreams data
Closed, ResolvedPublic

Description

Overview

Include a post's images as explicit attachments in the ActivityStreams data used in the fediverse.

Background

Pixelfed's dansup mentioned their interest in implementing Article support. We'll want to make sure the needed image data is there on our end.

Implementation

We already extract this information to include it in our own API data under the images property. We just need to include it in the AS data, too.

We'll need to do a little extra work to determine the mediaType and extract alt text for the name property, as seen below.

Example attachment property from Mastodon:

"attachment":[  
   {  
      "type":"Document",
      "mediaType":"image/png",
      "url":"https://m.abunchtell.com/system/media_attachments/files/000/001/763/original/a05a26af66d84266.png",
      "name":"A test screenshot of the WriteFreely install instructions."
   }
]

On Mastodon, name value is null if none supplied.

Revisions and Commits