|
<?php require_once('include_path_inc.php'); require_once('Text/CAPTCHA.php'); $options = array( 'width' => 200, 'height' => 80, 'imageOptions' => array( 'font_file' => 'DejaVuSans.ttf', //'font_path' => '.', 'font_size' => 15, 'text_color' => '#0000FF', 'background_color' => '#00FF00', 'lines_color' => '#FF0000' ) ); // Instanciation d'un objet Text_CAPTCHA de type Image $captcha = Text_CAPTCHA::factory('Image'); // Initialisation $err = $captcha->init($options); if (PEAR::isError($err)) { die("Erreur d'initialisation du CAPTCHA:".$err->getMessage()); } // Recuperation de l'image au format PNG $png = $captcha->getCAPTCHAAsPNG(); if (PEAR::isError($png)) { die("Impossible de creer l'image".$png->getMessage()); } // "Affichage" de l'image header("Content-Type: image/png"); echo $png; ?>
|