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!

1
  • have you run "php bin/magento catalog:images:resize" command? Commented Oct 13, 2021 at 14:21

1 Answer 1

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

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.