Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Resize wide screen product image
 
steslape
Jr. Member
 
Total Posts:  1
Joined:  2013-02-23
 

Hello,

I’m trying to upload a wide screen image as a product image in my shop. The image is really big (800x600) and I’m trying to display it in the format 250x400.

So I modified the media.phtml in my template to the following:

<img src="<?php echo $this->helper('catalog/image')->init($_product, 'image')->constrainOnly(TRUE)->keepAspectRatio(TRUE)->keepFrame(TRUE)->resize(250, 400);?>" alt='' title="<?php echo $this->htmlEscape($this->getImageLabel());?>" />

The problem here is: When I set keepAspectRatio to true, the image gets not distorted, but there is a white border at the top and bottom (so that it actually gets 400 pixels heigh). When I set keepAspectRatio to false, the image gets distorted, but it is 400px heigh.

But I want to achieve, that magento zooms the picture in, so that it gets not distorted, but it gets the required height and width. I found an excention that seems to do that (http://www.magentocommerce.com/magento-connect/alphanono/extension/153/direct-resize), but I tried that and it seems like that this extension does not work with magento 1.7. correctly.

How can I achieve that now?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top