0

I have set up a Magento install (v2.4.3) with WeltPixel's Pearl theme. The category view product images in grid view are showing cropped instead of being resized with extra bars added to make up the image ratio (which should be the default behaviour as far as I can tell). I have tried editing the view.xml file for the theme but I have not been able to find a way to change the cropping behaviour. I really want Magento to do its usual "proportional fit" thing, that is, not cropping any of the image but adding bars to make it fit.

What can I do to accomplish this? Thank you for any insights!

New contributor
maba is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
1
  • have you run "php bin/magento catalog:images:resize" command? Oct 13 at 14:21
0

View.xml is for setting the desired image size to be resize during called. Maybe you called the original image instead the resized one?

FYI, If displaying the image was also customize, you can call the resized image url by and set it to your image tag

$imageUrl = $this->imageHelper->init($product, 'category_page_grid')->getUrl();

// category_page_grid is the image id from the view.xml
// $product is the product collection

just inject the

\Magento\Catalog\Helper\Image $imageHelper

Your Answer

maba is a new contributor. Be nice, and check out our Code of Conduct.

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.