Magento 2 - Fotorama

user5138425 picture user5138425 · Jun 16, 2016 · Viewed 12.6k times · Source

I have a problem with the ProductSlider on the Productdetail Page. I dont know how to set the Container width & heights.

I found some configuration for the Fotorama Plugin but there is nothing about width and height.

My Productimages have another dimensions.

<div class="fotorama__stage" style="width: 581px; height: 581px; line-height: 581px;">

that are the dimensions from the Plugin.

My image dimensions are 530px x 350px, so there is too much white-space (top/bottom).

Any ideas?

Answer

Florin Marin picture Florin Marin · Mar 2, 2017

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
           }
        }
    }
}