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

Adjust the "preserve metadata" logic #6267

Merged
merged 4 commits into from Aug 4, 2023

Conversation

leofeyer
Copy link
Member

@leofeyer leofeyer commented Aug 4, 2023

Fixes #6205

One thing is still bothering me, though: If I use a predefined image size, the preserveMetadata key stores the formats to preserve.

$predefinedSizes = [
'foobar' => [
'width' => 100,
'height' => 200,
'resizeMode' => ResizeConfiguration::MODE_BOX,
'zoom' => 50,
'imagineOptions' => [
'jpeg_quality' => 77,
'jxl_quality' => 66,
],
'preserveMetadata' => [
ExifFormat::NAME => [],
IptcFormat::NAME => ['2#116', '2#080'],
],
],
];

In the tl_image_size table, however, the preserveMetadata key stores whether to overwrite the formats and the metadata key actually holds the formats to preserve.

$imageSizeProperties = [
'width' => 100,
'height' => 200,
'resizeMode' => ResizeConfiguration::MODE_BOX,
'zoom' => 50,
'preserveMetadata' => true,
'imageQuality' => 77,
'metadata' => serialize([
serialize([ExifFormat::NAME => ExifFormat::DEFAULT_PRESERVE_KEYS]),
serialize([IptcFormat::NAME => IptcFormat::DEFAULT_PRESERVE_KEYS]),
]),
];

Is this what we want?

@leofeyer leofeyer added the bug label Aug 4, 2023
@leofeyer leofeyer added this to the 5.2 milestone Aug 4, 2023
@leofeyer leofeyer self-assigned this Aug 4, 2023
@leofeyer leofeyer requested a review from ausi August 4, 2023 12:10
@leofeyer leofeyer linked an issue Aug 4, 2023 that may be closed by this pull request
@leofeyer leofeyer requested a review from ausi August 4, 2023 13:45
@leofeyer leofeyer merged commit 80df779 into contao:5.2 Aug 4, 2023
16 checks passed
@leofeyer leofeyer deleted the fix/preserve-metadata branch August 4, 2023 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Review the tl_image_size.preserveMetadata default
2 participants