Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Magento Product Details Image Size

Tags:

php

magento

Magento 1.4

Default Product Details image size is 265x265.

All of our product images will be probably 2x taller than wide, and even if we pad them to make them square 265 will be too small to see detail in the image, so we'd like to make the image taller.

I found the media.phtml file

How would we go about modifying this file/Magento so that the product details page image is 265W x 530H.

This looks like the code that displays the image.

<p class="product-image">
    <?php
        $_img = '<img src="'.$this->helper('catalog/image')->init($_product, 'image')->resize(265).'" alt="'.$this->htmlEscape($this->getImageLabel()).'" title="'.$this->htmlEscape($this->getImageLabel()).'" />';
        echo $_helper->productAttribute($_product, $_img, 'image');
    ?>
</p>
like image 395
Jason Avatar asked May 19 '10 20:05

Jason


2 Answers

Simply pass the height parameter into the resize function as well:

<p class="product-image">
    <?php
        $_img = '<img src="'.$this->helper('catalog/image')->init($_product, 'image')->resize(265, 530).'" alt="'.$this->htmlEscape($this->getImageLabel()).'" title="'.$this->htmlEscape($this->getImageLabel()).'" />';
        echo $_helper->productAttribute($_product, $_img, 'image');
    ?>
</p>

Hope that helps!

Thanks, Joe

like image 121
Joe Mastey Avatar answered Oct 11 '22 17:10

Joe Mastey


Use auto (or remove the number entirely) and then pass the width with the CSS and the height will set accordingly. The css is in boxes.css or if you are on blank theme its all in styles.css

.product-view .product-img-box .product-image img {
  width: 560px
}
like image 26
Thomas Avatar answered Oct 11 '22 15:10

Thomas