Skip to content

Commit 761bd24

Browse files
committed
#11888: Save background color correctly in images.
1 parent befe833 commit 761bd24

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@ public function process(\DOMElement $mediaNode, $mediaParentTag)
3131
if ($attribute->nodeType != XML_ELEMENT_NODE) {
3232
continue;
3333
}
34-
if ($attribute->tagName == 'background') {
34+
$attributeTagName = $attribute->tagName;
35+
if ($attributeTagName === 'background') {
3536
$nodeValue = $this->processImageBackground($attribute->nodeValue);
37+
} elseif ($attributeTagName === 'width' || $attributeTagName === 'height') {
38+
$nodeValue = intval($attribute->nodeValue);
3639
} else {
3740
$nodeValue = $attribute->nodeValue;
3841
}

app/code/Magento/Catalog/Test/Unit/Model/ImageExtractorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ protected function setUp()
2323
public function testProcess()
2424
{
2525
$expectedArray = include(__DIR__ . '/_files/converted_view.php');
26-
$this->assertEquals($expectedArray, $this->model->process($this->getDomElement(), 'media'));
26+
$this->assertSame($expectedArray, $this->model->process($this->getDomElement(), 'media'));
2727
}
2828

2929
/**

0 commit comments

Comments
 (0)