protected function _handleImageUpload(Fishpig_AttributeSplash_Model_Page $page, $field) { $data = $page->getData($field); if (isset($data['value'])) { $page->setData($field, $data['value']); } if (isset($data['delete']) && $data['delete'] == '1') { $page->setData($field, ''); } if ($filename = Mage::helper('attributeSplash/image')->uploadImage($field)) { $page->setData($field, $filename); } }
/** * Initialize the image object * This sets up the image object for resizing and caching * * @param Fishpig_AttributeSplash_Model_Page $page * @param string $attribute * @return Fishpig_AttributeSplash_Helper_Image */ public function init(Fishpig_AttributeSplash_Model_Page $page, $attribute = 'image') { $this->_imageObject = null; $this->_forceRecreate = false; $this->_filename = null; $this->_settings = array(); if ($imagePath = $this->getImagePath($page->getData($attribute))) { $this->_imageObject = new Varien_Image($imagePath); $this->_filename = basename($imagePath); $this->constrainOnly(true); $this->keepTransparency(true); $this->keepAspectRatio(true); } return $this; }