Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $session = new Zend_Session_Namespace('captcha');
- // check for existing phrase in session
- $phrase = null;
- if (isset($session->phrase) && strlen($session->phrase) > 0)
- $phrase = $session->phrase;
- $imageOptions = array(
- 'font_size' => 24,
- 'font_path' => Zend_Registry::get('config')->paths->data,
- // 'font_path' => '/home/denis/NetBeansProjects/gaSolutions/data/',
- 'font_file' => 'Ubuntu-RI.ttf',
- 'text_color' => '#DDFF99',
- 'lines_color' => '#CCEEDD',
- 'background_color' => '#555555'
- );
- $options = array(
- 'width' => 180,
- 'height' => 60,
- 'phrase' => $phrase,
- 'output' => 'png',
- 'imageOptions'=> $imageOptions
- );
- $captcha = Text_CAPTCHA::factory('Image');
- $captcha->init($options);
- $session->phrase = $captcha->getPhrase();
- // disable auto-rendering since we're outputting an image
- $this->_helper->viewRenderer->setNoRender();
- header('Content-type: image/png');
- // echo $captcha->getCAPTCHAAsPng();
- echo $captcha->getCAPTCHA();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement