以下功能可用于获取产品的图像高度和宽度。图像函数在Mage_Catalog_Helper_Image类中定义。
getOriginalWidth给出图像的宽度。
getOriginalHeigh或getOriginalHeight给出图像的高度。
getOriginalSizeArray给出数组中图像的高度和宽度。
$_product = $this->getProduct();
$imageWidth = $this->helper('catalog/image')->init($_product, 'image')->getOriginalWidth();
if($imageWidth > 600) {
$lightboxImage = $this->helper('catalog/image')->init($_product, 'image')->resize(600);
}
else {
$lightboxImage = $this->helper('catalog/image')->init($_product, 'image')->__toString();
}
// get height of image
$imageHeight = $this->helper('catalog/image')->init($_product, 'image')->getOriginalHeigh();
// get height width of image in array
$imageHeightWidthArray = $this->helper('catalog/image')->init($_product, 'image')->getOriginalSizeArray();
希望能帮助到你。谢谢。