How to get a product's image in Magento?

lock picture lock · Mar 19, 2010 · Viewed 180.5k times · Source

I'm running on version 1.3.2.1, but on my client's server they had Magento 1.3.0 so my previous code to display images for my local copy,

echo $this->helper('catalog/image')->init($_product)->resize(163, 100);

, does not work on the client's installation.

Looking at the results returned by their Magento, version 1.3.0 actually returns a URL although it points to the skin's media folder.

Is there a way to get the absolute image path for the image?
Or should I make changes somewhere else that would tell Magento that the media directory should be on the root?

Answer

silvo picture silvo · Jul 4, 2010
echo $_product->getImageUrl();

This method of the Product class should do the trick for you.