Skip to content
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

feature/strip encoder parameter #1421

Merged
merged 14 commits into from
Jan 18, 2025

Conversation

olivervogel
Copy link
Member

No description provided.

@olivervogel
Copy link
Member Author

I added the option to the global configuration and set the default values on the encoders to null which will default to the value of the global configuration.

$manager = ImageManager::withDriver($driver, strip: true); // set global default for all operations
$result = $manager->read('exif.jpg')->toJpeg(); // uses global default
$result = $manager->read('exif.jpg')->toJpeg(strip: false); // overrides global default
$result = $manager->read('exif.jpg')->toJpeg(strip: true); // overrides global default

I'm also thinking about renaming the option from strip to stripMeta? I'm not a native English speaker but I think strip is very arbitrary? What do you think? @deluxetom

Copy link
Contributor

@deluxetom deluxetom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, I like the global option, it makes it much easier.

As for GD, I agree, it just strips the exif metadata when encoding. I don't really like the method to create a new GD object and encoding to jpeg to remove it though as quality 100 for jpeg isn't lossless.

I would probably just disable the StripModifier for GD and throw an exception that the GD driver already strips metadata when encoding.

@deluxetom
Copy link
Contributor

I'm also thinking about renaming the option from strip to stripMeta? I'm not a native English speaker but I think strip is very arbitrary? What do you think? @deluxetom

I think strip is fine, I would just add a PHPDoc to add that it strips exif metadata. I'm not a native English speaker myself

src/Encoders/AvifEncoder.php Outdated Show resolved Hide resolved
src/Encoders/HeicEncoder.php Outdated Show resolved Hide resolved
src/Encoders/Jpeg2000Encoder.php Outdated Show resolved Hide resolved
src/Encoders/JpegEncoder.php Outdated Show resolved Hide resolved
src/Encoders/TiffEncoder.php Outdated Show resolved Hide resolved
src/Encoders/WebpEncoder.php Outdated Show resolved Hide resolved
Copy link
Contributor

@deluxetom deluxetom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perfect, once thats merged, I'll fix image-driver-vips to add that modifier

@olivervogel olivervogel merged commit 6b9ce4f into develop Jan 18, 2025
16 checks passed
@olivervogel olivervogel deleted the deluxetom-feature/strip-encoder-parameter branch January 18, 2025 15:42
@olivervogel
Copy link
Member Author

perfect, once thats merged, I'll fix image-driver-vips to add that modifier

Cool. You can use intervention image ^3.11 for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants