_getAdapter($adapter); $this->_fileName = $fileName; if( isset($fileName) ) { $this->open(); } } /** * Retrieve image adapter object * * @param string $adapter * @return Varien_Image_Adapter_Abstract */ protected function _getAdapter($adapter=null) { if(!isset($this->_adapter)) { $this->_adapter = new Lanot_EasySticker_Model_Image_Adapter_Gd2(); } return $this->_adapter; } /** * Adds watermark to our image. * * @param string $watermarkImage. Absolute path to watermark image. * @param int $positionX. Watermark X position. * @param int $positionY. Watermark Y position. * @param int $watermarkImageOpacity. Watermark image opacity. * @param bool $repeat. Enable or disable watermark brick. * @access public * @return void */ public function stickerWatermark($watermarkImage, $positionX=0, $positionY=0, $watermarkImageOpacity=30, $repeat=false) { if( !file_exists($watermarkImage) ) { throw new Exception("Required file '{$watermarkImage}' does not exists."); } if ($this->_getAdapter() instanceof Lanot_EasySticker_Model_Image_Adapter_Gd2) { $this->_getAdapter()->stickerWatermark($watermarkImage, $positionX, $positionY, /* $watermarkImageOpacity, */ $repeat); } else { $this->_getAdapter()->watermark($watermarkImage, $positionX, $positionY, $watermarkImageOpacity, $repeat); } } }