i know this question is just being asked many times but i have some problem in custom image attribute i create new custom image(image180) attribute with magento admin & using this code to get image in frontend & this code working properly & showing image how to correct this & thanks in advance

<div class="rotate"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'image180'); ?>"></div>

but i have to check if this image is avabile then run the code if not avaible don't run this code because if this attribute not avaible fir specific product the product page is not load & show the error & i am using this code to check avability of custom image but not working what going wrong

<?php if ($_product->getimage180()):?>
                <div class="rotate"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'image180'); ?>"></div>
                <?php endif;?>

To get physical path of your image, if img is (storing img in media/custom/)directory

$path = Mage::getBaseDir('media').'/custom/'.$image180;
    //code if image exists

$image180 is the name of your image /custom/ is the subdirectory inside media where you store the custom image. Hope this is helps,


To get product attribute use this,

  • thanks, i can get complete directory of image with name with thos code $this->helper('catalog/image')->init($_product, 'image180') but don't know how just image name
    – Dinesh
    Dec 25 '14 at 9:07
  • see my Updated answer.. Dec 26 '14 at 4:18

When you add a custom product image attribute you also need to create appropriate placeholder image. Try something like this and see if it resolves your issue:

Create (or copy default Magento placeholder image) to: skin/frontend/base/default/images/catalog/product/placeholder/image180.jpg


When creating a new attribute of type Media Image, it's not automatically available on the frontend.

You can quickly check this by executing the following query:

SELECT * FROM `catalog_eav_attribute` where attribute_id = [id]

The value is_visible_on_front will probably be set to 0. If this is the case, you should update it and change it to 1.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.