Advertisement
d3n1S

PEAR Text_CAPTCHA 1.0.2 stable, Image_Text 0.7.0 beta

May 22nd, 2014
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.18 KB | None | 0 0
  1. $session = new Zend_Session_Namespace('captcha');
  2.         // check for existing phrase in session
  3.         $phrase = null;
  4.         if (isset($session->phrase) && strlen($session->phrase) > 0)
  5.             $phrase = $session->phrase;
  6.        
  7.         $imageOptions = array(
  8.             'font_size' => 24,
  9.             'font_path' => Zend_Registry::get('config')->paths->data,
  10. //            'font_path' => '/home/denis/NetBeansProjects/gaSolutions/data/',
  11.             'font_file' => 'Ubuntu-RI.ttf',
  12.             'text_color' => '#DDFF99',
  13.             'lines_color' => '#CCEEDD',
  14.             'background_color' => '#555555'
  15.         );
  16.        
  17.         $options = array(
  18.             'width' => 180,
  19.             'height' => 60,
  20.             'phrase' => $phrase,
  21.             'output' => 'png',
  22.             'imageOptions'=> $imageOptions
  23.         );
  24. $captcha = Text_CAPTCHA::factory('Image');
  25. $captcha->init($options);
  26. $session->phrase = $captcha->getPhrase();
  27. // disable auto-rendering since we're outputting an image
  28.         $this->_helper->viewRenderer->setNoRender();
  29.         header('Content-type: image/png');
  30. //        echo $captcha->getCAPTCHAAsPng();
  31.         echo $captcha->getCAPTCHA();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement