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 Apr 12, 2017 at 12:37
  • Open template path hints from admin panel. You will see which page is showing up. Apr 12, 2017 at 13:49
  • its showing product for gallary.phtml file its correct file to edit product page Apr 12, 2017 at 13:53
  • gallery.phtml should be a file for thumbnail images..not for the main image. But not sure. Apr 12, 2017 at 13:56

2 Answers 2

$_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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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