Skip to content

Commit de372ec

Browse files
fixed issue with img that hasn't src
1 parent b4a7351 commit de372ec

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Plugin/BlockPlugin.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,20 @@ public function afterToHtml(\Magento\Framework\View\Element\AbstractBlock $block
7272
return $html;
7373
}
7474

75-
$pixelSrc = 'src="' . $block->getViewFileUrl('Magefan_LazyLoad::images/pixel.jpg') . '"';
75+
$pixelSrc = ' src="' . $block->getViewFileUrl('Magefan_LazyLoad::images/pixel.jpg') . '"';
7676
$tmpSrc = 'TMP_SRC';
7777

7878
$html = str_replace($pixelSrc, $tmpSrc, $html);
7979

80-
$html = preg_replace('#<img\s+([^>]*)(?:src="([^"]*)")([^>]*)\/?>#isU', '<img ' . $pixelSrc .
80+
$html = preg_replace('#<img\s+([^>]*)(?:src="([^"]*)")([^>]*)\/?>#isU', '<img ' .
8181
' data-original="$2" $1 $3/>
8282
<noscript>
8383
<img src="$2" $1 $3 />
8484
</noscript>
8585
', $html);
8686

87+
$html = str_replace(' data-original=', $pixelSrc . ' data-original=', $html);
88+
8789
$html = str_replace($tmpSrc, $pixelSrc, $html);
8890
$html = str_replace(self::LAZY_TAG, '', $html);
8991

0 commit comments

Comments
 (0)