cancel
Showing results for 
Search instead for 
Did you mean: 

How to change product image size in Magento 2

   Did you know you can see the translated content as per your choice?

Translation is in progress. Please check again after few minutes.

How to change product image size in Magento 2

In the gird view of a category I want to reduce the number of products per ROW from 4 to 3, and I want to increase the image size there ... how can I do that?

2 REPLIES 2

Re: How to change product image size in Magento 2

The image re-size dimensions can be changed in <theme>/etc/view.xml, for the category listing pages you would need to change the <image id="category_page_grid" type="small_image"> dimensions.

 

How have you made your theme? Do you use Blank as the parent?

 

Re: How to change product image size in Magento 2

You can also specify image dimensions directly in template file like this:

 

<?php
/**
* @var $block \Magento\Catalog\Block\Product\Widget\NewWidget
*/
$image = 'new_products_content_widget_grid';
$items = $block->getProductCollection()->getItems();
$width = 100;
$height = 100;
foreach ($items as $_item) {
    $resizedUrl = $block->resizeImage($_item, $image , $width, $height)->getUrl();
    echo '<img src="'.$resizedUrl .'" alt="alt text" />';
}

More samples here - https://nwdthemes.com/2017/12/19/magento-2-product-image-size/