-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Strip parameter to encoders that support exif #1420
Strip parameter to encoders that support exif #1420
Conversation
@@ -37,4 +37,17 @@ public function testEncodeProgressive(): void | |||
$this->assertEquals('image/jpeg', $result->mimetype()); | |||
$this->assertTrue($this->isProgressiveJpeg($result)); | |||
} | |||
|
|||
public function testEncodeStripExif(): void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The GD thing is tricky. There is no real function to delete meta data, but it is possible to create a new GDImage object and copy the data into it. The metadata is not transferred.
However, this does not lead to a consistent result. As the copy action described is used at various points in modifiers in order to achieve different results.
- src/Drivers/Gd/Modifiers/RotateModifier.php:83
- src/Drivers/Gd/Modifiers/ContainModifier.php:53
- src/Drivers/Gd/Modifiers/QuantizeColorsModifier.php:45
- src/Drivers/Gd/Modifiers/BlendTransparencyModifier.php:25
- src/Drivers/Gd/Modifiers/CropModifier.php:46
- src/Drivers/Gd/Modifiers/ResizeModifier.php:40
- src/Drivers/Gd/Modifiers/CoverModifier.php:40
Basically, the metadata is (almost) always lost with GD and Intervention Image, even if this is not desired. :( This is also the reason why I have not yet integrated a “strip” feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metadata is apparently not taken into account at all with GD.
$data = fopen('php://temp', 'r+');
$img = imagecreatefromjpeg('exif.jpg'); // decode
imagejpeg($img, $data); // encode
$exif = exif_read_data($data); // exif gone
I have developed this further here: #1421 |
work in progress