-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
base: 4.7
Are you sure you want to change the base?
Conversation
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. |
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 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. |
c6cb511
to
f85e635
Compare
@paulbalandan Now I'm wondering, shouldn't we also modify the interface? It would be a breaking change, but making sure every handler has the |
That seems fair considering that we want to reduce the disconnect of methods in the abstract class and the interface. However, we should also think if other image handlers (if there's any) implementing solely the interface would need the |
There are two other possible image handlers that come to my mind: Gmagick and libvips. Both support clearing metadata from images, so including a It's possible that someone has extended the existing handlers to add new features, but this would not produce any problems. If a new handler had been developed, I would assume we’d have seen a PR by now - though perhaps that’s an optimistic assumption. @samsonasik Do you have any opinion on this one? |
Hmm. Then we can go add the clearMetadata method to the interface. |
I have added this new method to the interface. |
Description
This PR introduces a flexible
clearMetadata()
method that allows for convenientand configurableremoval 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 sameclearMetadata()
method, but it is implemented as a no-op (does nothing).Reference: #6149 (comment)
Checklist: