在Magento,我有一个页面,我很难对某些产品的图像进行编码。我不想简单地使用产品的图片网址这样做,而是想对产品的相关图片使用动态参考,这样如果我更改产品的图片,此页面上的参考文件就不会中断。我需要缩略图大小的图像和大图像。有谁知道怎么做?
答案 0 :(得分:0)
假设您已经可以$_product
$thumbImageUrl = Mage::helper('catalog/image')->init($_product, 'small_image')->resize($width, $height);
$imageUrl = Mage::helper('catalog/image')->init($_product, 'image')->resize($width, $height);
// if you don't want to resize at all
$imageUrl = $_product->getMediaConfig()->getMediaUrl($_product->getData('image'));