Skip to content

An analysis of the idea to implement an image object block in the WordPress Block Editor. #2146

@Jiwoon-Kim

Description

@Jiwoon-Kim

An analysis of the idea to implement an image object block in the WordPress Block Editor.

Based on the current progress, I believe it is appropriate to open an issue for this. The following content likely pertains to information that should be included in the json-ld of a media attachment post.

  1. Included in the body (content). 2. Included in the attachment. 3. Included in comments.

1. Included in the body (content)

Inclusion of an ActivityPub object within the body itself is a non-standard interaction. However, it appears to be a feasible feature to implement within WordPress.

Currently, an image included in the body is not an ActivityPub object; it's an HTML array (typically within a gallery block). However, it could be made interactive via the Jetpack carousel.

In federation, the wp-block-gallery is replaced with ap-block-gallery.
This would allow all images to become interactive image objects if the follower is a WordPress instance.

Feature Idea

  • Support Attachment Post Links in the Gallery Block
    → Provide a compatibility option to the image object block in the block editor. When inserting images into a gallery, it would allow the retrieval of an image from a ?attachment_id=123 permalink instead of a simple file URL.
    → There's no need to load the entire object; you only need to retrieve the file path URL, the URL of the post type: attachment, and the author ID. This could be considered a non-standard interaction and might be a Jetpack-specific mechanism.

  • Image-Level Federation
    → This allows for direct interaction with a media library's Image object, rather than a simple hotlink to an image within the post body.

  • Image Carousel and Comments
    → On my instance, images can be viewed individually in the image carousel (=Gallery UI).
    → A user on a remote instance can directly send actions like comments or likes to a specific Image Object.
    → In short, it enables interaction at the image level, not just with the entire post.

Technical Considerations

  • The ActivityPub plugin must add logic to convert ?attachment_id=123 into an Image Object.
  • Interactions like comments or likes must be mapped to direct actions with the Image object in the ActivityStreams 2.0 specification.

2. Included in the attachment

This model involves directly including a remote instance's Image object in the attachment array of your post (Note or Article), rather than simply embedding an <img> tag. This would create a concept like a WordPress "Shared Media Library."

According to GPT, the core question is whether the attachment must be an "image from the original instance." In the specification, that's not a requirement.

  • The attachment field can simply include an object like { "type": "Image", "id": "https://remote.instance/media/123", "url": "…" }.
  • The id must be the original image object's id from the source instance.
  • This turns your post into a simple statement of "This Note attaches that object," and the remote instance can handle interactions with its own Image object.

In short, just as Facebook bundles notes, images, and video objects within a single post, ActivityPub can also pull content using a "reference model."


3. Included in comments

This involves displaying images included in comments received via the inbox. If you can display image objects in the body, it would naturally be possible to display them in comments as well.


An example of an ActivityStreams 2.0 Image Object that includes the WordPress Media Library structure, various resized/rotated versions, and an extension field (as:license):

{
  "@context": [
    "https://www.w3.org/ns/activitystreams",
    {
      "as:license": "https://www.w3.org/ns/activitystreams#license"
    }
  ],
  "id": "https://travel-in-busan.com/?attachment_id=18735",
  "type": "Image",
  "name": "A cup of black coffee and a croissant pastry on a wooden tray",
  "attributedTo": "https://kimjiwoon96.wordpress.com/?author=1",
  "mediaType": "image/webp",
  "url": [
    {
      "type": "Link",
      "href": "https://travel-in-busan.com/wp-content/uploads/2025/08/20250522_160858-150x150.jpg",
      "mediaType": "image/webp",
      "width": 150,
      "height": 150,
      "name": "Thumbnail"
    },
    {
      "type": "Link",
      "href": "https://travel-in-busan.com/wp-content/uploads/2025/08/20250522_160858-300x300.jpg",
      "mediaType": "image/webp",
      "width": 300,
      "height": 300,
      "name": "Medium"
    },
    {
      "type": "Link",
      "href": "https://travel-in-busan.com/wp-content/uploads/2025/08/20250522_160858-1024x1024.jpg",
      "mediaType": "image/webp",
      "width": 1024,
      "height": 1024,
      "name": "Large"
    },
    {
      "type": "Link",
      "href": "https://travel-in-busan.com/wp-content/uploads/2025/08/20250522_160858-2560x2560.jpg",
      "mediaType": "image/webp",
      "width": 2560,
      "height": 2560,
      "name": "Full-size"
    }
  ],
  "as:license": "https://creativecommons.org/licenses/by/4.0/"
}

The extension field license can be a custom extension like as:license.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions