0

我有一个名为的图像:

Mage::getModel('catalog/product')->load($_product->getId())->getMediaGalleryImages()->getItemByColumnValue('position','2')

那是第二张图片(排序依据)。

需要能够在此使用 Magento 的 resize() ,我能做到这一点吗?

4

1 回答 1

1

未测试,但尝试

$_image = Mage::getModel('catalog/product')->load($_product->getId())->getMediaGalleryImages()->getItemByColumnValue('position','2');

echo $this->helper('catalog/image')->init($_product, 'thumbnail', $_image->getFile())->resize(30, 30);

/app/code/core/Mage/Catalog/Helper/Image.php

public function init(Mage_Catalog_Model_Product $product, $attributeName, $imageFile=null)

请参阅http://www.magentocommerce.com/boards/v/viewthread/264272/#t356324

于 2012-11-02T01:45:20.380 回答