/** * @service * @anonym * * @param $name */ public function getImage(Gpf_Rpc_Params $params) { $form = new Gpf_Rpc_Form($params); $lenght = self::TEXT_LENGTH; if (strlen($form->getFieldValue('length'))) { $lenght = $form->getFieldValue('length'); } $text = $this->generateText($lenght); Gpf_Session::getInstance()->setVar(self::SESSION_PREFIX . $form->getFieldValue('name'), $text); $captchaGenerator = new Gpf_Common_Captcha_ImageGenerator($text); $height = 50; $width = self::TEXT_LENGTH * 30; if (strlen($params->get('height'))) { $height = $params->get('height'); } if (strlen($params->get('width'))) { $height = $params->get('width'); } $captchaGenerator->setSize($width, $height); return $captchaGenerator; }