Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions app/code/Magento/Catalog/Model/ImageExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,16 @@ public function process(\DOMElement $mediaNode, $mediaParentTag)
continue;
}
$attributeTagName = $attribute->tagName;
if ($attributeTagName === 'background') {
$nodeValue = $this->processImageBackground($attribute->nodeValue);
} elseif ($attributeTagName === 'width' || $attributeTagName === 'height') {
$nodeValue = intval($attribute->nodeValue);
if ((bool)$attribute->getAttribute('xsi:nil') !== true) {
if ($attributeTagName === 'background') {
$nodeValue = $this->processImageBackground($attribute->nodeValue);
} elseif ($attributeTagName === 'width' || $attributeTagName === 'height') {
$nodeValue = intval($attribute->nodeValue);
} else {
$nodeValue = $attribute->nodeValue;
}
} else {
$nodeValue = $attribute->nodeValue;
$nodeValue = null;
}
$result[$mediaParentTag][$moduleNameImage][Image::MEDIA_TYPE_CONFIG_NODE][$imageId][$attribute->tagName]
= $nodeValue;
Expand Down
14 changes: 7 additions & 7 deletions lib/internal/Magento/Framework/Config/etc/view.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@
<xs:element name="image" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="width" type="xs:positiveInteger" minOccurs="0"/>
<xs:element name="height" type="xs:positiveInteger" minOccurs="0"/>
<xs:element name="constrain" type="xs:boolean" minOccurs="0"/>
<xs:element name="aspect_ratio" type="xs:boolean" minOccurs="0"/>
<xs:element name="frame" type="xs:boolean" minOccurs="0"/>
<xs:element name="transparency" type="xs:boolean" minOccurs="0"/>
<xs:element name="background" minOccurs="0">
<xs:element name="width" type="xs:positiveInteger" minOccurs="0" nillable="true"/>
<xs:element name="height" type="xs:positiveInteger" minOccurs="0" nillable="true"/>
<xs:element name="constrain" type="xs:boolean" minOccurs="0" nillable="true"/>
<xs:element name="aspect_ratio" type="xs:boolean" minOccurs="0" nillable="true"/>
<xs:element name="frame" type="xs:boolean" minOccurs="0" nillable="true"/>
<xs:element name="transparency" type="xs:boolean" minOccurs="0" nillable="true"/>
<xs:element name="background" minOccurs="0" nillable="true">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="\[(\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\]"/>
Expand Down