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?

2
  • You can change image height and width. Commented May 17, 2017 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
    Commented May 17, 2017 at 6:20

1 Answer 1

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.

0

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.