Can anyone help me to resize the product page product image in magento2
-
magento.stackexchange.com/questions/137766/…– Kingshuk DebApr 12, 2017 at 11:28
-
Can you please help me where to edit the file location in magento2 for product page– shivashankar mApr 12, 2017 at 12:37
-
Open template path hints from admin panel. You will see which page is showing up.– Kingshuk DebApr 12, 2017 at 13:49
-
its showing product for gallary.phtml file its correct file to edit product page– shivashankar mApr 12, 2017 at 13:53
-
gallery.phtml should be a file for thumbnail images..not for the main image. But not sure.– Kingshuk DebApr 12, 2017 at 13:56
2 Answers
$_imageHelper = $this->helper('Magento\Catalog\Helper\Image');
$productImage = $_imageHelper->init($_product, $image)->constrainOnly(FALSE)->keepAspectRatio(TRUE)->keepFrame(FALSE)->resize(400)->getUrl();
If you are building a theme: Copy the file [vendor]/[theme]/etc/view.xml from your base theme into your own theme, and edit the relevant image size values. I think it might be product_page_image_medium
.
Make sure you copy the whole file, not just the image setting, or it will break other things. There is no inheritance mechanism for this file.