| // +---------------------------------------------------------------------------+ /** * Strategy for adding image across original one. * * @package SGL * @author Dmitri Lakachauskis */ class SGL_ImageTransform_AddImageStrategy extends SGL_ImageTransformStrategy { function transform() { if (count($this->aParams) == 1 && is_int(key($this->aParams))) { $this->aParams = array('file' => reset($this->aParams)); } if (!isset($this->aParams['file'])) { return SGL::raiseError('file param not specified', SGL_ERROR_INVALIDARGS); } $this->aParams['file'] = SGL_APP_ROOT . '/' . $this->aParams['file']; if (!file_exists($this->aParams['file'])) { return SGL::raiseError('file not found', SGL_ERROR_NOFILE); } $aDefaultParams = array( 'trans' => 0, 'alignX' => 'right', 'alignY' => 'bottom', 'paddingX' => 0, 'paddingY' => 0 ); $aDefaultParams = array_merge($aDefaultParams, $this->aParams); $aDefaultParams['trans'] = 100 - $aDefaultParams['trans']; return $this->driver->addImage($aDefaultParams); } } ?>