How to Resize fotoroma library popup when clicking on product image on product view page in Magento 2?

758 views Asked by At

I want to set custom height and width of fotorama fullscreen image popup/lightbox. How to do that....please help.

enter image description here

2

There are 2 answers

1
LitExtension Magento Migration On

You have to edit the following file:

app/design/vendor/Magento_Catalog/templates/product/view/gallery.phtml

Here you can add your options:

<script type="text/x-magento-init">
{
    "[data-gallery-role=gallery-placeholder]": {
        "mage/gallery/gallery": {
            "mixins":["magnifier/magnify"],
            "magnifierOpts": <?php /* @escapeNotVerified */ echo $block->getMagnifier(); ?>,
            "data": <?php /* @escapeNotVerified */ echo $block->getGalleryImagesJson(); ?>,
            "options": {
                "maxheight": "700", // Add your value here
           }
        }
    }
}
0
LitExtension Magento Migration On

Check

app/design/frontend/{package}/{theme}/template/catalog/product/view/media.phtml.

If your theme is somehow similar with the default one you should find something like this:

<a href="#" onclick="popWin('<?php echo $this->getGalleryUrl($_image) ?>', 'gallery', 'width=300,height=300,left=0,top=0,location=no,status=yes,scrollbars=yes,resizable=yes'); return false;"title="<?php echo $this->htmlEscape($_image->getLabel()) ?>">
<img
   src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(56); ?>"
   width="56"
   height="56"
   alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>"
   />
</a>;