Fixed some GD detection bugs with freecap
authorDan
Sat, 07 Jun 2008 12:40:29 -0400
changeset 558 fd082123f2f4
parent 557 26479224936a
child 559 cfdc0aa8af50
Fixed some GD detection bugs with freecap
includes/captcha.php
includes/captcha/engine_freecap.php
--- a/includes/captcha.php	Sat Jun 07 12:39:24 2008 -0400
+++ b/includes/captcha.php	Sat Jun 07 12:40:29 2008 -0400
@@ -166,10 +166,10 @@
     $engine = getConfig('captcha_engine');
     if ( !$engine )
     {
-      $engine = 'bc';
+      $engine = 'freecap';
     }
   }
-  if( !extension_loaded("gd") || !function_exists("gd_info") || !function_exists('imagettftext') )
+  if( !extension_loaded("gd") || !function_exists("gd_info") || !function_exists('imagettftext') || !function_exists('imagepng') || !function_exists('imagecreatefromjpeg') )
   {
     $engine = 'failsafe';
   }
--- a/includes/captcha/engine_freecap.php	Sat Jun 07 12:39:24 2008 -0400
+++ b/includes/captcha/engine_freecap.php	Sat Jun 07 12:40:29 2008 -0400
@@ -388,7 +388,7 @@
       ImageFill($this->im3,0,0,$bg3);
       $temp_bg_col = ImageColorAllocate($temp_bg,255,255,255);
       ImageFill($temp_bg,0,0,$temp_bg_col);
-    
+      
       // we draw all noise onto temp_bg
       // then if we're morphing, merge from temp_bg to im3
       // or if not, just copy a $widthx$height portion of $temp_bg to $this->im3
@@ -459,7 +459,7 @@
           $temp_width[$i] = imagesx($temp_im[$i]);
           $temp_height[$i] = imagesy($temp_im[$i]);
         }
-    
+        
         $blocksize = $this->rand_func(20,60);
         for($i=0 ; $i<$width*2 ; $i+=$blocksize)
         {