Uh oh!
There was an error while loading. Please reload this page.
feat: add clearMetadata() method to provide privacy options when using imagick handler - #9538
Conversation
michalsn
commented
Apr 22, 2025
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
commented
Apr 23, 2025
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
f85e635Comparemichalsn
commented
May 2, 2025
@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 |
paulbalandan
commented
May 2, 2025
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 |
michalsn
commented
May 2, 2025
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? |
Uh oh!
There was an error while loading. Please reload this page.
paulbalandan
commented
May 2, 2025
Hmm. Then we can go add the clearMetadata method to the interface. |
michalsn
commented
May 3, 2025
I have added this new method to the interface. |
191bd1d to
ffa314aComparemichalsn
commented
May 8, 2025
The user guide syntax check seems like the upstream problem: sphinx-doc/sphinx#13533 |
michalsn
commented
May 8, 2025
Thank you @samsonasik, @paulbalandan and @datamweb |
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
BaseHandleralso provides the sameclearMetadata()method, but it is implemented as a no-op (does nothing).Reference: #6149 (comment)
Checklist: