Add EXIF metadata support for image attachments#2751
Draft
Add EXIF metadata support for image attachments#2751
Conversation
…space. Adds support for extracting and including EXIF data from images in ActivityPub image attachments using the Vernissage namespace.
There was a problem hiding this comment.
Pull request overview
This PR adds EXIF metadata support for ActivityPub image attachments by implementing the Vernissage namespace specification. The implementation extracts WordPress image metadata and converts it to standardized EXIF properties that are included in ActivityPub JSON output for image attachments.
Changes:
- Added EXIF data extraction and formatting in the Base transformer class
- Added Vernissage namespace context to ActivityPub objects
- Added comprehensive test coverage for EXIF metadata handling
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| includes/transformer/class-base.php | Implements get_exif_data() method to extract and format EXIF metadata, and integrates it into transform_attachment() |
| includes/activity/class-base-object.php | Adds Vernissage namespace (photos) and EXIF context to ActivityPub JSON-LD |
| tests/phpunit/tests/includes/transformer/class-test-post.php | Adds five test cases covering EXIF data extraction, formatting, filtering, and integration |
| .github/changelog/2751-from-description | Documents the feature addition for changelog |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Change property from 'exif' (Vernissage) to 'exifData' (Schema.org) - Use array of PropertyValue objects with @type, name, and value - Update JSON-LD context to use schema.org vocabulary - Field names now follow FEP-ee3a: DateTime, ExposureTime, FNumber, FocalLength, PhotographicSensitivity, Model - DateTime format changed to EXIF standard "YYYY:MM:DD HH:MM:SS" Reference: https://codeberg.org/fediverse/fep/pulls/750
Changed the default value of the $offset parameter from 0 to 5 in the schedule_outbox_activity_for_federation method to adjust the scheduling behavior.
…ation" This reverts commit 51dfe71.
Resolve conflicts: - FEDERATION.md: Keep both FEP-9098 (Custom Emojis) and FEP-ee3a (EXIF) - class-test-post.php: Keep location tests from trunk and EXIF tests from branch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2759
Proposed changes:
PropertyValueobjects with@type,name, andvaluefields using theexifDataproperty.created_timestamp→DateTime(EXIF format "YYYY:MM:DD HH:MM:SS")shutter_speed→ExposureTime(fraction format like "1/100")aperture→FNumber(format like "f/2.8")focal_length→FocalLengthiso→PhotographicSensitivitycamera→Modelactivitypub_image_exiffilter for extending EXIF data (e.g., addingMake,LensModel, GPS coordinates)Other information:
Testing instructions:
?activitypubto the URL)exifDataarray with PropertyValue objectsExample expected output:
{ "type": "Image", "url": "https://example.com/image.jpg", "mediaType": "image/jpeg", "exifData": [ { "@type": "PropertyValue", "name": "DateTime", "value": "2024:01:01 00:00:00" }, { "@type": "PropertyValue", "name": "ExposureTime", "value": "1/100" }, { "@type": "PropertyValue", "name": "FNumber", "value": "f/2.8" }, { "@type": "PropertyValue", "name": "FocalLength", "value": "50" }, { "@type": "PropertyValue", "name": "PhotographicSensitivity", "value": "400" }, { "@type": "PropertyValue", "name": "Model", "value": "Canon EOS R5" } ] }Changelog entry
Changelog Entry Details
Significance
Type
Message
Add EXIF metadata support for image attachments (FEP-ee3a).