开发者

Magento Product Details Image Size

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 disp开发者_运维技巧lays 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>


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


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
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜