Media Upload Endpoint and Remote Media Library #2329
Replies: 5 comments 30 replies
-
|
Media Upload Endpoint and Remote Media Library
The appropriate approach may vary depending on the object type, My current idea is to first load the JSON-LD metadata of all attachment objects, then render the appropriate image size version according to the viewport value, applying lazy loading to inline images or gallery blocks within the content field. To implement inline images in the content field of an article, an extension of the HTML markup language is required.
Yes, I know that Mastodon caches all attachment images locally, but WordPress operates on a very different architecture. If there is no media library, implementing the media object endpoint will be difficult, so the existence of a media object can be assumed to mean that a media library and media upload endpoint exist. My opinion is that for this reason, media file direct links and media objects should be clearly distinguished. The attachment page is the ideal location because it includes the JSON-LD representation of the media object. For platforms that have a media library, In fact, most microblogging platforms in the Fediverse do not have media libraries. In both cases, I think the default behavior should maintain hotlinking (remote connections). I think the content of a remote image object should basically maintain a hotlink. When license extensions are applied, files are optionally cached locally, and the file URL is replaced with a local URL only when explicit reuse permission is granted, but the original URI is preserved.
The fact that remote media attachments remain even after the remote article is deleted is normal, because it means the media can continue to be reused through the media library.
https://fedi.tips/how-to-download-your-mastodon-post-archive/ Additional reference materials #2146 (comment) #2145 https://make.wordpress.org/core/2023/07/07/media-library/
https://make.wordpress.org/ai/2025/07/17/ai-building-blocks/
https://core.trac.wordpress.org/ticket/63953 Inline images and attachmentsAll inline images in an Article should also appear in
FEP-1311: Media Attachments introduces the concept of multiple media versions and licensing. FEP-e232: Object Links Issue with WordPress:
Multiple media versionsFor heavy photologs (up to 50 images per post), embedding all versions in the Article object is inefficient.
Related core proposal: |
Beta Was this translation helpful? Give feedback.
-
|
@Menrath Personally, I think it’s better to handle post-type objects like
However, I’m not entirely sure whether it’s truly necessary to parse the That’s why I suggested that direct file links should be treated as hotlinks, In any case, implementing remote media local caching now could still be useful later, I wanted to suggest that WordPress could independently implement a |
Beta Was this translation helpful? Give feedback.
-
|
The media upload is mainly for Client2Server communication, it is not meant to be used by Server2Server interactions. |
Beta Was this translation helpful? Give feedback.
-
📁 Attachment (Media) Hierarchy in WordPress
🖼️ Image Versions and Media Object FederationWhen you upload an image in WordPress, multiple size versions are automatically generated. Relevant references:
Related WordPress documentation:
🧩 Inline Images and Attachment ImplementationWhen implementing inline images from the
📚 Followable CollectionsI’m also exploring the concept of followable collections, similar to Pinterest boards: Related FEPs:
🧠 Additional FEP References
😊 Custom Emoji IntegrationWordPress already supports smilies, which could be adapted to display remote instance custom emojis: |
Beta Was this translation helpful? Give feedback.
-
|
I discovered something quite shocking: you should never use an In WordPress, the media library is responsible for generating and storing the actual image objects, while the There have been discussions around using content-addressable identifiers such as https://www.w3.org/TR/activitypub/#source-property Proposed ImprovementsIt would also be good if media objects included in the In addition, similar to how the Relevant References
Comparison Between Mastodon and WordPress ImplementationsUsing ActivityPub Explorer, I compared the Mastodon Notehttps://mastodon.social/@thaumiel999/115388078017230651 "attachment": [
{
"type": "Document",
"mediaType": "image/jpeg",
"url": "https://files.mastodon.social/media_attachments/files/115/388/077/548/299/024/original/3e5bb134e4ce6bf6.jpg",
"name": null,
"blurhash": "UkL;jSWBWEs:t7j[WBay~qoft7azR*WBofj[",
"width": 709,
"height": 918
},
{
"type": "Document",
"mediaType": "image/jpeg",
"url": "https://files.mastodon.social/media_attachments/files/115/388/077/651/773/360/original/cbc3ae89fb7a12ff.jpg",
"name": null,
"blurhash": "UWK1wK_NDjt6?vozRjt7D*s.WAR*M|t6RPWB",
"width": 736,
"height": 544
},
{
"type": "Document",
"mediaType": "image/jpeg",
"url": "https://files.mastodon.social/media_attachments/files/115/388/077/742/211/858/original/e12ecdd557b94725.jpg",
"name": null,
"blurhash": "UEJt;lWqbH-:-;tQ9GD*xbe.W=Rk~pIV?G?Z",
"width": 760,
"height": 801
},
{
"type": "Document",
"mediaType": "image/jpeg",
"url": "https://files.mastodon.social/media_attachments/files/115/388/077/826/994/996/original/e61959d9e2e0f137.jpg",
"name": null,
"blurhash": "UCG8o-?bN{RjT{WCIVIo0LjEIURj0Lf5xaay",
"width": 754,
"height": 781
}
]WordPress.com Note"id": "https://kimjiwoon96.wordpress.com/?p=8099",
"type": "Note",
"attachment": [
{
"type": "Image",
"url": "https://kimjiwoon96.wordpress.com/wp-content/uploads/2025/10/20251011_180821.webp?w=1024",
"mediaType": "image/webp"
},
{
"type": "Image",
"url": "https://kimjiwoon96.wordpress.com/wp-content/uploads/2025/10/20251011_154338.webp?w=1024",
"mediaType": "image/webp"
},
{
"type": "Image",
"url": "https://kimjiwoon96.wordpress.com/wp-content/uploads/2025/10/20251011_165805.webp?w=1024",
"mediaType": "image/webp"
},
{
"type": "Image",
"url": "https://kimjiwoon96.wordpress.com/wp-content/uploads/2025/10/20251011_165847.webp?w=1024",
"mediaType": "image/webp"
}
]In this comparison, Mastodon correctly uses UploadMedia Endpoint and File/Object SeparationThe W3C SocialCG Media Upload specification defines the However, what’s crucial is the specification’s explicit separation between file and object:
And further:
The WordPress IronyIronically, this separation between file and object is exactly how WordPress already operates.
Thus, WordPress’s internal model already mirrors ActivityPub’s conceptual separation between resource (file) and metadata object (ActivityStreams Document/Image). Therefore, the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
This post expands on some ideas mentioned in [#2314 – Add Attachments processor class for handling ActivityPub media](#2314), particularly around how remote vs. local media handling should work in WordPress.
1. Background
Recent improvements such as smart media markup and inline image handling have raised an important architectural question:
How should ActivityPub attachments (media objects) be handled differently from direct media file links?
Platforms like Mastodon cache all attachments locally, but WordPress operates with a Media Library, which introduces a fundamentally different model.
Therefore, the optimal approach may depend on the object type (e.g.,
Articlevs.Note) and the presence of a media library endpoint.2. Key distinctions
Media file direct links
Media objects
?remote_attachment_id=123for access and federation.3. Proposed workflow
Load attachment JSON-LD metadata first.
Then apply lazy loading for inline images or gallery blocks based on viewport size.
Implement remote media objects as hotlinks by default.
The content of a remote image object remains a hotlink unless explicit reuse permission (license) is declared.
Optional local caching with license extension.
If a [FEP-c118 Content Licensing](https://codeberg.org/fediverse/fep/src/branch/main/fep/c118/fep-c118.md) policy is detected, the system may:
Remote attachment persistence.
Remote media attachment pages can remain even after the original post is deleted, since they may be reused or referenced via the media library.
4. Inline images and multiple versions
According to [FEP-b2b8: Long-form Text](https://codeberg.org/fediverse/fep/src/branch/main/fep/b2b8/fep-b2b8.md#content),
However, WordPress’s Gutenberg system often uses gallery blocks with multiple image versions.
This makes simple inline-image models insufficient.
A better approach could follow the principles of [FEP-1311](https://codeberg.org/fediverse/fep/src/branch/main/fep/1311/fep-1311.md) (multiple media versions) and [FEP-e232](https://codeberg.org/fediverse/fep/src/branch/main/fep/e232/fep-e232.md) (object links).
For performance, Articles might reference a container URI (improved
attachment_idpermalink) that serves all image versions.5. Relation to core proposals
?attachment_id=123These efforts align naturally with the goal of introducing a Remote Media Library and Media Upload Endpoint for federated environments.
6. Conclusion
In summary:
inReplyTo) on remote media attachment pages once the underlying endpoint exists.I’ll continue exploring this idea under the title “Media Upload Endpoint and Remote Media Library.”
Beta Was this translation helpful? Give feedback.
All reactions