2012-11-02 22 views
0

調整圖像我有一個被稱爲像的圖像:在Magento

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

這是第二圖像(排序)。

需要能夠使用Magento的調整大小()在這個,我能做到這一點的任何方式?

回答

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

+0

它不是設置爲縮略圖或其他任何東西,它會繼續工作嗎? –