In Related Product Slider, All Images are of different size and default Magento is not resizing them. Screenshot : https://prnt.sc/oax7yl

enter image description here I want to show all images of the same size.

In view.xml, I have added the width and height of Image but not worked.

<image id="related_products_list" type="small_image">

Please suggest me some solution.


3 Answers 3


for this, you have to upload the image of the same dimensions for all products you want if you upload the image of different dimension it will create this issue. this issue can be solved by CSS but it is not recommended because some time image might get stretched out so the best solution is to upload the image of the same dimensions for all products


Below code solve the issue:-

$objectManager =\Magento\Framework\App\ObjectManager::getInstance();
$helperImport = $objectManager->get('\Magento\Catalog\Helper\Image');
$imageUrl = $helperImport->init($_product, 'product_page_image_small')
->setImageFile($_product->getFile()) // image,small_image,thumbnail

I used this code because the issue not solved after doing changes in view.xml.


For individual product, try saving the product in admin without any change.

For all products, try running the following command (this will take some time to complete):

php bin/magento catalog:images:resize
  • this is the copy of @MohitRane comment. Please someone mark it as copy. I don't know how to mark it.
    – temper
    Nov 29, 2019 at 12:02

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.