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