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

please find the screenshot: enter image description here

  • magento.stackexchange.com/questions/137766/… Commented Apr 12, 2017 at 11:28
  • Can you please help me where to edit the file location in magento2 for product page Commented Apr 12, 2017 at 12:37
  • Open template path hints from admin panel. You will see which page is showing up. Commented Apr 12, 2017 at 13:49
  • its showing product for gallary.phtml file its correct file to edit product page Commented Apr 12, 2017 at 13:53
  • gallery.phtml should be a file for thumbnail images..not for the main image. But not sure. Commented 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 you have read our privacy policy.

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