Can anyone help me to resize the product page product image in magento2

please find the screenshot: enter image description here

  • Can you please help me where to edit the file location in magento2 for product page – shivashankar m Apr 12 '17 at 12:37
  • Open template path hints from admin panel. You will see which page is showing up. – Kingshuk Deb Apr 12 '17 at 13:49
  • its showing product for gallary.phtml file its correct file to edit product page – shivashankar m Apr 12 '17 at 13:53
  • gallery.phtml should be a file for thumbnail images..not for the main image. But not sure. – Kingshuk Deb Apr 12 '17 at 13:56
$_imageHelper = $this->helper('Magento\Catalog\Helper\Image');
$productImage = $_imageHelper->init($_product, $image)->constrainOnly(FALSE)->keepAspectRatio(TRUE)->keepFrame(FALSE)->resize(400)->getUrl();
| improve this answer | |

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.