如何在 Magento 中获取产品的图像? [英] How to get a product's image in Magento?

查看:26
本文介绍了如何在 Magento 中获取产品的图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 1.3.2.1 版本上运行,但在我客户的服务器上,他们有 Magento 1.3.0所以我以前的代码为我的本地副本显示图像,

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.

看看他们的 Magento 返回的结果,1.3.0 版实际上返回了一个 URL,尽管它指向皮肤的媒体文件夹.

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.

有没有办法获得图像的绝对图像路径?
或者我应该在其他地方进行更改,告诉 Magento 媒体目录应该在根目录上?

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?

推荐答案

echo $_product->getImageUrl();

Product 类的这个方法应该可以为您解决问题.

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

这篇关于如何在 Magento 中获取产品的图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆