I have created an attribute for image as "custom_image" to show it in the in the header for every product.

I have get the base_image with the following code:

<?php $_product = Mage::registry('current_product')->getId();
$product = Mage::getModel('catalog/product')->load($_product);
$product_image = $product->getImageUrl();

Now i want to get the custom_image and i have tried it like:

 $product_image = $product->getImageUrl(custom_image);

but it is not working kindly guide me what wrong i am doing and how i can get the custom image attribute.


enter image description here


use below code

$product_imag=str_replace('/index.php', '',Mage::getUrl('media/catalog/product').$product->getCustomImage());
  • if i want to get the URL of this image then? @Gopal Patel
    – Xabby
    Jan 4 '17 at 10:26
  • It is just showing /p/1/p12-carrar24_2.jpg this thing i need the full URL how i can get that? @Gopal Patel
    – Xabby
    Jan 4 '17 at 10:55
  • @Xabby find updated answer Jan 4 '17 at 10:57
  • I did its going to 404 page not image found: usatilea.nextmp.net/index.php/media/catalog/product/p/1/…
    – Xabby
    Jan 4 '17 at 11:00
  • @Xabby make sure that image is present at that location Jan 4 '17 at 11:04

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.