Public Member Functions | |
getUrl ($object, $size=null) |
Definition at line 35 of file Image.php.
getUrl | ( | $ | object, | |
$ | size = null | |||
) |
Definition at line 38 of file Image.php.
00039 { 00040 $url = false; 00041 $image = $object->getData($this->getAttribute()->getAttributeCode()); 00042 00043 if( !is_null($size) && file_exists(Mage::getBaseDir('media').DS.'catalog'.DS.'product'.DS.$size.DS.$image) ) { 00044 # resized image is cached 00045 $url = Mage::app()->getStore($object->getStore())->getBaseUrl('media').'catalog/product/' . $size . '/' . $image; 00046 } elseif( !is_null($size) ) { 00047 # resized image is not cached 00048 $url = Mage::app()->getStore($object->getStore())->getBaseUrl().'catalog/product/image/size/' . $size . '/' . $image; 00049 } elseif ($image) { 00050 # using original image 00051 $url = Mage::app()->getStore($object->getStore())->getBaseUrl('media').'catalog/product/'.$image; 00052 } 00053 return $url; 00054 }