Thursday, April 19, 2012

getImageUrl() no returning any value in an external php

I am trying to display the image url in an external file. What I did is the following.



require_once '/var/www/html/app/Mage.php';
Mage::app();
$product = Mage:: getModel('catalog/product')->load(11);
echo $product->getImageUrl();


But the $product->getImageUrl() didnot return any value.
The file is located in the root folder where the index.php is present.
When I print the $product->getImage() , it displayed the image name.



Is the getImageUrl() not a default function in magento ?



when i used the function $Image = $product->getMediaConfig()->getMediaUrl($product->getData('image'));
the image url is displayed.





No comments:

Post a Comment