Magento – get product images
Posted on: October 15, 2010 /
Categories: Magento
This code can be used to get all images for product:
$_product = Mage::getModel('catalog/product');
$_product->load($product_id);
// Get image gallery
$_gallery = $_product->getMediaGalleryImages();
// Go through each image
foreach ($_gallery as $_image)
{
// Display image
echo '<img src=\'' . $_image->getUrl() . '\' alt=\'' . $_image->getLabel() . '\' />';
}