55 */
66namespace Magento \Catalog \Model ;
77
8- use Magento \Catalog \Model \Product \Attribute \Backend \Media \ImageEntryConverter ;
98use Magento \Catalog \Helper \Image ;
9+ use Magento \Catalog \Model \Product \Attribute \Backend \Media \ImageEntryConverter ;
10+ use Magento \Framework \View \Xsd \Media \TypeDataExtractorInterface ;
1011
11- class ImageExtractor implements \ Magento \ Framework \ View \ Xsd \ Media \ TypeDataExtractorInterface
12+ class ImageExtractor implements TypeDataExtractorInterface
1213{
1314 /**
1415 * Extract configuration data of images from the DOM structure
@@ -30,8 +31,11 @@ public function process(\DOMElement $mediaNode, $mediaParentTag)
3031 if ($ attribute ->nodeType != XML_ELEMENT_NODE ) {
3132 continue ;
3233 }
33- if ($ attribute ->tagName == 'background ' ) {
34+ $ attributeTagName = $ attribute ->tagName ;
35+ if ($ attributeTagName === 'background ' ) {
3436 $ nodeValue = $ this ->processImageBackground ($ attribute ->nodeValue );
37+ } elseif ($ attributeTagName === 'width ' || $ attributeTagName === 'height ' ) {
38+ $ nodeValue = intval ($ attribute ->nodeValue );
3539 } else {
3640 $ nodeValue = $ attribute ->nodeValue ;
3741 }
@@ -55,6 +59,7 @@ private function processImageBackground($backgroundString)
5559 $ backgroundArray = [];
5660 if (preg_match ($ pattern , $ backgroundString , $ backgroundArray )) {
5761 array_shift ($ backgroundArray );
62+ $ backgroundArray = array_map ('intval ' , $ backgroundArray );
5863 }
5964 return $ backgroundArray ;
6065 }
0 commit comments