Francis Kim
Francis Kim

Reputation: 4285

Resizing Images in Magento

I have an image that is called like:

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

That is the 2nd image (sort by).

Need to be able to use Magento's resize() on this, any way I can do this?

Upvotes: 0

Views: 293

Answers (1)

MagePal Extensions
MagePal Extensions

Reputation: 17656

Not tested, but try

$_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)

See http://www.magentocommerce.com/boards/v/viewthread/264272/#t356324

Upvotes: 1

Related Questions