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 77<?php
88/** @var $block \Magento\Catalog\Block\Product\Image */
99/** @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+ */
1015$ borders = (bool )$ block ->getVar ('product_image_white_borders ' , 'Magento_Catalog ' );
1116$ enableLazyLoadingWithoutBorders = (bool )$ block ->getVar (
1217 'enable_lazy_loading_for_images_without_borders ' ,
@@ -24,8 +29,6 @@ $enableLazyLoadingWithoutBorders = (bool)$block->getVar(
2429 <?php endforeach ; ?>
2530 src="<?= $ escaper ->escapeUrl ($ block ->getImageUrl ()) ?> "
2631 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 -->
2932 <?php if ($ borders || $ enableLazyLoadingWithoutBorders ): ?>
3033 width="<?= $ escaper ->escapeHtmlAttr ($ block ->getWidth ()) ?> "
3134 height="<?= $ escaper ->escapeHtmlAttr ($ block ->getHeight ()) ?> "
You can’t perform that action at this time.
0 commit comments