Magento Coding Solutions

get Product Media image by productId Magento

 <?php $_images = Mage::getModel('catalog/product')->load($_product->getId())->getMediaGalleryImages(); ?>  
<?php if($_images){?>          
<?php $i=0; foreach($_images as $_image)
print_r($_image);
if ($i++ < 5) { $i++; ?>
<img class="gallery" src="<?php echo $this->helper('catalog/image')->init($product, 'thumbnail', $_image->getFile())->resize(255); ?>" alt="<?php echo $this->htmlEscape($_image->getLabel());?>" title="<?php $this->htmlEscape($_image->getLabel());?>" />
<?php } ?>
<?php } ?>

No comments:

Post a Comment