Magento Coding Solutions

Get Gallery Images in Magento by Product Id

<?php
include "../app/Mage.php";
Mage::app();

$product_id=$_REQUEST['product'];
$product=Mage::getModel('catalog/product')->load($product_id);
$mediaImages=$product->getMediaGalleryImages();
foreach($mediaImages as $_image){
  
    ?>
     <li>
        <a href="<?php echo Mage::helper('catalog/image')->init($product, 'thumbnail', $_image->getFile())->resize(364,418); ?>" title="<?php echo $_image->getLabel();?>" onclick="$('image').src = this.href; return false;">
            <img src="<?php echo Mage::helper('catalog/image')->init($product, 'thumbnail', $_image->getFile())->resize(76,70); ?>" width="76" height="70" alt="<?php echo $_image->getLabel(); ?>" />          
            </a>
     </li>
    <?php
  
  
    }
    ?>

No comments:

Post a Comment