On our category view in grid mode, our images got all different sizes. (see screenshot) Images already got a max-height class to give them all the same height. The problem of this is inside the image-file, because some images got more white space around the product than others.

We get our images from a open catalog with product images.

Beside changing the images manually, by uploading the correct format. Is there an other way to give all our product images the same height and white space? (So I mean that some images got more white space than others, so that they look all the same)


3 Answers 3


Magento can create images with the same dimensions. But: if image A has 20px whitespace as default and image B 2px, A is 300x200px and B is 1200x1800px there is no way to process this totally programmatically.

You can create the images with same dimensions on the fly like this in your app/design/frontend/[theme]/[name]/catalog/product/list.phtml where is defined the image:

$imageSource = $this->helper('catalog/image')
    ->init($_product, 'image')
    ->quality(75) // as option
    ->resize([imagewidth], [imageheight]); // set width and height

Go to the image-tag and set for the src-attribute <?php echo $imageSource; ?>

Hope this helps a little bit.


there is only one way to do that is to fix images itself and make it all the same size withe the same padding around it


uploading new images would be the best and safest way, although there is ways of trimming whitespace.

Here's an example with php:


  • Thanks! :) But how can I integrate this into my list.phtml file, so that all our catalog images will be trimmed of their whitespaces.
    – JGeer
    Mar 5, 2015 at 20:57

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.