Magento产品详细信息图像大小

时间:2010-05-19 20:53:06

标签: php magento

Magento 1.4

默认产品详细信息图片大小为265x265。

我们所有的产品图像都可能比宽度高2倍,即使我们用它们填充它们使它们成为正方形265也会太小而无法在图像中看到细节,因此我们希望使图像更高。

我找到了media.phtml文件

我们如何修改此文件/ Magento,以便产品详情页面图像为265W x 530H。

这看起来像显示图像的代码。

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

2 个答案:

答案 0 :(得分:5)

只需将height参数传递给resize函数:

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

希望有所帮助!

谢谢, 乔

答案 1 :(得分:2)

使用auto(或完全删除数字),然后使用CSS传递宽度,相应地设置高度。 css位于boxes.css中,或者如果您处于空白主题,则全部位于styles.css

.product-view .product-img-box .product-image img {
  width: 560px
}
相关问题