Skip to content

feat: add clearMetadata() method to provide privacy options when using imagick handler #9538

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: 4.7
Choose a base branch
from

Conversation

michalsn
Copy link
Member

Description
This PR introduces a flexible clearMetadata() method that allows for convenient and configurable removal of image metadata, which can improve privacy.

While metadata such as EXIF is automatically stripped when using the GD image handler, this method is specifically designed for use with the Imagick handler, where metadata is preserved by default.

To ensure API consistency, the BaseHandler also provides the same clearMetadata() method, but it is implemented as a no-op (does nothing).

Reference: #6149 (comment)

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@michalsn michalsn added enhancement PRs that improve existing functionalities 4.7 labels Apr 22, 2025
@michalsn
Copy link
Member Author

Okay, I guess I have to revisit the data I'm trying to strip. I will look for an example JPEG (preferably small) with some ready EXIF data because our default PNG acts differently depending on the OS.

This will have to wait, probably for tomorrow.

@michalsn
Copy link
Member Author

Okay, apparently I was too optimistic to introduce various options for deleting metadata and we have to make it work only with simple stripping of all the data. When imagick shows properties like exif:DateTime, it's parsed from the binary profile for display, but deletion via deleteImageProperty() doesn't actually modify the binary EXIF block.

I thought I could make it more flexible, but it will not work the same for all images… Now, after the changes, we will have the same functionality for both handlers - just stripping all the metadata.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.7 enhancement PRs that improve existing functionalities
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant