* @author Bharat Mediratta */ /** * Display the current captcha image for this session * * @package Captcha * @subpackage UserInterface */ class CaptchaImageView extends GalleryView { /** * @see GalleryView::isImmediate */ function isImmediate() { return true; } /** * @see GalleryView::renderImmediate */ function renderImmediate($status, $error) { global $gallery; $session =& $gallery->getSession(); $code = $session->get('captcha.key'); header('Content-type: image/jpeg'); header('Pragma: No-cache'); $image = @ImageCreateFromJPEG(dirname(__FILE__) . '/data/code_bg.jpg'); $textColor = ImageColorAllocate($image, 80, 80, 80); $width = (imagesx($image) - 10 * strlen($code)) / 2; ImageString($image, 5, $width, 40, $code, $textColor); ImageJPEG($image, '', 75); ImageDestroy($image); return null; } } ?>