Mage_Catalog_Model_Category_Attribute_Backend_Image Class Reference

Inheritance diagram for Mage_Catalog_Model_Category_Attribute_Backend_Image:

Mage_Eav_Model_Entity_Attribute_Backend_Abstract Mage_Eav_Model_Entity_Attribute_Backend_Interface

List of all members.

Public Member Functions

 beforeSave ($object)


Detailed Description

Definition at line 35 of file Image.php.


Member Function Documentation

beforeSave ( object  ) 

Enter description here...

Parameters:
Varien_Object $object

???

Reimplemented from Mage_Eav_Model_Entity_Attribute_Backend_Abstract.

Definition at line 43 of file Image.php.

00044     {
00045         $value = $object->getData($this->getAttribute()->getName());
00046 
00047         if (is_array($value) && !empty($value['delete'])) {
00048             $object->setData($this->getAttribute()->getName(), '');
00049             $this->getAttribute()->getEntity()
00050                 ->saveAttribute($object, $this->getAttribute()->getName());
00051             return;
00052         }
00053 
00054         $path = Mage::getBaseDir('media') . DS . 'catalog' . DS . 'category' . DS;
00055 
00056         try {
00057             $uploader = new Varien_File_Uploader($this->getAttribute()->getName());
00058             $uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
00059             $uploader->setAllowRenameFiles(true);
00060             $uploader->save($path);
00061 
00062             $object->setData($this->getAttribute()->getName(), $uploader->getUploadedFileName());
00063             $this->getAttribute()->getEntity()->saveAttribute($object, $this->getAttribute()->getName());
00064         } catch (Exception $e) {
00065             /** @TODO ??? */
00066             return;
00067         }
00068 
00069     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:23:38 2009 for Magento by  doxygen 1.5.8