Magento - 调整图像大小,保持纵横比,裁剪超过大小的内容



我想在 magento 中调整图像大小,保持其纵横比,并使其用另一种纵横比填充矩形。

例:

我的图像是 640x480

我的矩形是 100x50

我希望图像填充所有矩形并裁剪超过它的内容。

我知道keepFrame(FALSE) - 它不会使图像填充矩形,而是使其适合内部并且不裁剪任何内容。

另外,如果你熟悉Wordpress,我想要的是做:*add_image_size('home',370,256,true);*

谢谢:)

看看@

由于 magento 更改了页面链接结构,请尝试 http://web.archive.org/web/20140707042130/http://www.magentocommerce.com/boards/viewthread/47269/

裁剪产品缩略图以清理正方形

尝试

<img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->constrainOnly(TRUE)->keepAspectRatio(TRUE)->keepFrame(FALSE)->resize(120,null); ?>" width="120" alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>" title="<?php echo $this->htmlEscape($_image->getLabel()) ?>" />

最新更新