magento

Product Image Urls

Introduction#

Get product image urls for thumbnail, small image and base image. Get cached as well and non caches direct media urls.

Cached Image urls

Mage::helper('catalog/image')->init($item->getProduct(), 'thumbnail');
Mage::helper('catalog/image')->init($item->getProduct(), 'small_image');
Mage::helper('catalog/image')->init($item->getProduct(), 'image');

Non cached Image Urls from Media

Mage::getModel('catalog/product_media_config')->getMediaUrl($product->getThumbnail()); //Thumbnail
Mage::getModel('catalog/product_media_config')->getMediaUrl($product->getSmallImage()); //Small Image
Mage::getModel('catalog/product_media_config')->getMediaUrl($product->getImage()); //Base

This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow