1

I would like to remove width="" and height="" from my product images in Magento 2. I found in list.phtml the php img tag:

<?php echo $productImage->toHtml(); ?>

I already know how to control the sizes of the images in view.xml. But I want to remove the width and height tags from the IMG.

How can I do this?

  • You can change image height and width. – Suresh Chikani May 17 '17 at 5:57
  • I already know how to control the sizes of the images in view.xml. But I want to remove the width and height tags from the IMG. – Tamibon May 17 '17 at 6:20
2

The default image template on product listing page is one of the following files depending on your configuration:

vendor/magento/module-catalog/view/frontend/templates/product/image.phtml
vendor/magento/module-catalog/view/frontend/templates/product/image_with_borders.phtml

You can overwrite them in your theme.

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.