Update of /cvsroot/phpwiki/phpwiki/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29252 Modified Files: Captcha.php Log Message: fallback to PNG or GIF if JPEG support does not exist Index: Captcha.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/Captcha.php,v retrieving revision 1.4 retrieving revision 1.5 diff -u -2 -b -p -d -r1.4 -r1.5 --- Captcha.php 30 Oct 2005 14:20:42 -0000 1.4 +++ Captcha.php 31 Oct 2005 16:44:13 -0000 1.5 @@ -160,7 +160,16 @@ class Captcha { imageline($jpg, $width-1,0,$width-1,$height-1,$tx); - //TODO: JPEG or PNG? + if (function_exists("ImageJpeg")) { header("Content-type: image/jpeg"); ImageJpeg($jpg); + } elseif (function_exists("ImagePNG")) { + header("Content-type: image/png"); + ImagePNG($jpg); + } elseif (function_exists("ImageGIF")) { + header("Content-type: image/gif"); + ImageGIF($jpg); + } else { + trigger_error("missing GD bitmap support", E_USER_WARNING); + } } @@ -168,4 +177,7 @@ class Captcha { // $Log$ +// Revision 1.5 2005年10月31日 16:44:13 rurban +// fallback to PNG or GIF if JPEG support does not exist +// // Revision 1.4 2005年10月30日 14:20:42 rurban // move Captcha specific vars and methods into a Captcha object