More than 1000+ satisfied clients and counting, since 2010


Show Magento Product Images using Different Methods

Show Magento Product Images Magento CMS is the most preferred eCommerce content management system. Its unique and advanced features make customizations easy. Creative and dynamic portals can be created using Magento. The best part of Magento is its flexibility. This post covers how to show Magento product images using different methods.

Best Ways to Show Magento Product Images

There are a number of ways by which we can show Magento product images for an online store. Few of the most common and functioning methods are highlighted below. Paste the codes to show Magento product images wherever you wish:

  • echo $_product->getImageUrl();
  • $_product->getMediaGalleryImages()->getItemByColumnValue(‘label’, ‘LABEL_NAME’)->getUrl();
  • (string)Mage::helper(‘catalog/image’)->init($_product, ‘image’)->resize(150)
  • echo $this->helper(‘catalog/image’)->init($_product, ‘small_image’)->resize(163, 100);

Complete Code to Show Magento Product Images

$collection = Mage::getModel('catalog/product')->getCollection();
foreach ($collection as $product) {
$prod = Mage::helper('catalog/product')->getProduct($product->getId(), null, null);
$attributes = $prod->getTypeInstance(true)->getSetAttributes($prod);
$galleryData = $prod->getData('media_gallery');
foreach ($galleryData['images'] as &$image) {
} }

Written by

The author didnt add any Information to his profile yet