Magento – Product image size issue – Fotorama – Magento EE 2.2.4

configurable-productfotoramamagento2product-images

I have issue in image height calculation in fotorama in Magento EE 2.2.4.
The image div(fotorama__stage)height is assigning by Script as inline css.

It is happens in some products only.

<div class="fotorama__stage" data-fotorama-stage="fotorama__stage" style="width: XXXpx; height: XXXpx;">

This is the perfect height assigned to the div as per image size.
enter image description here

This is the imperfect height assigned to the div as per image size.
enter image description here

Sometimes it displays perfect image as per actual image size but sometimes it displaying incorrectly.

I'm using Magento EE 2.2.4 with production mode.
I have only configurable products in this project.

Anyone know about such kind of issue?

Best Answer

app/design/frontend/Custom/mytheme/Magento_Catalog/templates/product/view/gallery.phtml

add "maxheight": "550", // Add your value here

<script type="text/x-magento-init">
    {
        "[data-gallery-role=gallery-placeholder]": {
            "mage/gallery/gallery": {
                "mixins":["magnifier/magnify"],
                "magnifierOpts": <?= /* @escapeNotVerified */ $block->getMagnifier() ?>,
                "data": <?= /* @escapeNotVerified */ $block->getGalleryImagesJson() ?>,
                "options": <?= /* @noEscape */ $block->getGalleryOptions()->getOptionsJson() ?>,
                "fullscreen": <?= /* @noEscape */ $block->getGalleryOptions()->getFSOptionsJson() ?>,
                "breakpoints": <?= /* @escapeNotVerified */ $block->getBreakpoints() ?>,
                "maxheight": "550"  //Add your value here
            }
        }
    }
</script>
Related Topic