We are running Magento 184.108.40.206
Is it possible to have different image size in the template on each category ?
The problem is that one category has original pictures in landscape while other categories has original pictures in portrait. Our window size for product images are in portrait format so when we add pictures in landscape they dont look very nice. We are not able to crop the pictures because then we loose valuable information. Resizing does not work out either so we wonder if its possible to set different image size for each category.
You can add different size image as your category requirement
<?php echo $this->helper('catalog/image')->init($_product, 'small_image') ->constrainOnly(false) ->keepAspectRatio(true) ->keepFrame(true) ->resize(160, 210); ?>
you can put this code
Change below code on line 50
<img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
You can create the images with same dimensions on the fly like this in yourapp/design/frontend/[theme]/[name]/catalog/product/list.phtml where is defined the image:
$imageSource = $this->helper('catalog/image') ->init($_product, 'image') ->constrainOnly(true) ->keepAspectRatio(true) ->keepFrame(true) ->keepTransparency(true) ->backgroundColor(array(255,255,255)) ->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; ?>