Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get a product's image in Magento?

Tags:

magento

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?

like image 621
lock Avatar asked Mar 18 '10 23:03

lock


People also ask

Where does Magento store product images?

All the images are stored under the pub/media/catalog/product folder in the Magento root. If the product image name is abc. jpg then it's stored under the above folder with an a/b/abc.

What is product image URL?

Definition of Product Image URL: The Uniform Resource Locator (URL) for the high- resolution product image that clearly depicts the primary selling surface of the product. Retailers should be able to use the image to authenticate the identity of the item.


1 Answers

echo $_product->getImageUrl(); 

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

like image 96
silvo Avatar answered Nov 12 '22 19:11

silvo