[pLog-svn] r1136 - plugins/trunk/authimage

mark at devel.plogworld.net mark at devel.plogworld.net
Sat Feb 19 09:49:32 GMT 2005


Author: mark
Date: 2005-02-19 09:49:31 +0000 (Sat, 19 Feb 2005)
New Revision: 1136

Modified:
   plugins/trunk/authimage/pluginauthimage.class.php
Log:
Add a if statement to check the imagegif is exist or not. I should work for people who don't have gif-related  function.

Modified: plugins/trunk/authimage/pluginauthimage.class.php
===================================================================
--- plugins/trunk/authimage/pluginauthimage.class.php	2005-02-19 09:41:40 UTC (rev 1135)
+++ plugins/trunk/authimage/pluginauthimage.class.php	2005-02-19 09:49:31 UTC (rev 1136)
@@ -96,10 +96,20 @@
             $background = AUTHIMAGE_BACKGROUND_FOLDER.$this->default;
             $tempFile = $this->cacheFolder."/".$encrypt.".gif";
             
-            $image = @imagecreatefromgif($background) or die("Cannot Initialize new GD image stream"); 
+            if ( !function_exists ( 'imagecreatefromgif' ) ) {
+                $image = @imagecreatefrompng($background) or die("Cannot Initialize new GD image stream"); 
+            } else {
+                $image = @imagecreatefromgif($background) or die("Cannot Initialize new GD image stream"); 
+            }           
+            
             $textColor = imageColorAllocate($image, 0x00, 0x00, 0x00);
             ImageString($image, 5, 7, 2, $code, $textColor);
-            ImageGIF($image, $tempFile);
+
+            if ( !function_exists ( 'ImageGIF' ) ) {
+                ImagePNG($image, $tempFile);
+            } else {
+                ImageGIF($image, $tempFile);
+            }
             
             $temp = fopen($tempFile,"rb");
             $buffer = fread($temp,filesize($tempFile));




More information about the pLog-svn mailing list