Resize different images to square without white space
-
15-04-2021 - |
Domanda
I am trying to force all the images in the product grid to square. The database serves images from ultra wide to ultra high ratios.
i'm trying the following:
$productImage = $imagehelper->init($product, 'category_page_grid')
->constrainOnly(false)
->keepAspectRatio(true)
->keepFrame(false)
->resize(400, 400)
->getUrl();
?>
But whatever i try i always seem to be getting white space for the images that have a high image ratio (side note i do not want the aspect ratio to be distorted) .. what i want is magento to look for a square in the middle of the image and just cut off the rest, no matter if it's high or wide.
anyone have an idea?
Nessuna soluzione corretta
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a magento.stackexchange