Skip to content

Commit a289250

Browse files
committed
MAGETWO-89051: Absorb image optimization from 2.1 into 2.3
1 parent 51deebc commit a289250

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

app/code/Magento/Catalog/Model/ImageExtractor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function process(\DOMElement $mediaNode, $mediaParentTag)
3737
} elseif ($attributeTagName === 'width' || $attributeTagName === 'height') {
3838
$nodeValue = intval($attribute->nodeValue);
3939
} else {
40-
$nodeValue = $attribute->nodeValue;
40+
$nodeValue = !in_array($attribute->nodeValue, ['false', '0']);
4141
}
4242
$result[$mediaParentTag][$moduleNameImage][Image::MEDIA_TYPE_CONFIG_NODE][$imageId][$attribute->tagName]
4343
= $nodeValue;

app/code/Magento/Catalog/Model/Product/Image/ParamsBuilder.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,13 @@ private function overwriteDefaultValues(array $imageArguments): array
102102
$angle = $imageArguments['angle'] ?? $this->defaultAngle;
103103

104104
return [
105-
'background' => $background,
105+
'background' => (array) $background,
106106
'angle' => $angle,
107107
'quality' => $this->defaultQuality,
108-
'keep_aspect_ratio' => $aspectRatio,
108+
'keep_aspect_ratio' => (bool) $aspectRatio,
109109
'keep_frame' => (bool) $frame,
110-
'keep_transparency' => $transparency,
111-
'constrain_only' => $constrain,
110+
'keep_transparency' => (bool) $transparency,
111+
'constrain_only' => (bool) $constrain,
112112
];
113113
}
114114

app/code/Magento/MediaStorage/Service/ImageResize.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -219,12 +219,8 @@ private function getViewImages(array $themes): array
219219
private function getUniqImageIndex(array $imageData): string
220220
{
221221
ksort($imageData);
222-
$index = '';
223222
unset($imageData['type']);
224-
foreach ($imageData as $key => $data) {
225-
$index .= "$key:$data|";
226-
}
227-
return $index;
223+
return md5(serialize($imageData));
228224
}
229225

230226
/**

0 commit comments

Comments
 (0)