我需要重新调整XML Feed的图像大小。我正在循环浏览产品,但试图获取重新调整大小的图像的URL时,我遇到了问题。如何从产品集合中获取产品图片网址?
foreach ($collection as $_product) {
$MainImage = Mage::helper('catalog/image')->init($_product, 'small_image')->constrainOnly(false)->keepAspectRatio(true)->keepFrame(true)
->keepTransparency(true)->resize(300, 150);
$arr['Image'] = $_product->getSmallImageUrl();
$arr['MainImage'] = $MainImage;
$arr['Name'] = $_product->getName();
}
如果我回显$ MainImage它会返回一个URL,但由于某种原因,它不喜欢在一个字符串中。
基本上,如果我然后回显数组它不显示图像的URL,它只是空白。
任何人都可以指向正确的方向吗?