File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
app/code/Magento/Catalog/view/frontend/templates/product Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 7
7
<?php
8
8
/** @var $block \Magento\Catalog\Block\Product\Image */
9
9
/** @var $escaper \Magento\Framework\Escaper */
10
+ /**
11
+ * Enable lazy loading for images with borders and if variable enable_lazy_loading_for_images_without_borders
12
+ * is enabled in view.xml. Otherwise small size images without borders may be distorted. So max-width is used for them
13
+ * to prevent stretching and lazy loading does not work.
14
+ */
10
15
$ borders = (bool )$ block ->getVar ('product_image_white_borders ' , 'Magento_Catalog ' );
11
16
$ enableLazyLoadingWithoutBorders = (bool )$ block ->getVar (
12
17
'enable_lazy_loading_for_images_without_borders ' ,
@@ -24,8 +29,6 @@ $enableLazyLoadingWithoutBorders = (bool)$block->getVar(
24
29
<?php endforeach ; ?>
25
30
src="<?= $ escaper ->escapeUrl ($ block ->getImageUrl ()) ?> "
26
31
loading="lazy"
27
- <!-- Enable lazy loading for images with borders and if variable
28
- enable_lazy_loading_for_images_without_borders in view.xml is enabled -->
29
32
<?php if ($ borders || $ enableLazyLoadingWithoutBorders ): ?>
30
33
width="<?= $ escaper ->escapeHtmlAttr ($ block ->getWidth ()) ?> "
31
34
height="<?= $ escaper ->escapeHtmlAttr ($ block ->getHeight ()) ?> "
You can’t perform that action at this time.
0 commit comments