[pLog-svn] r1653 - plugins/trunk/authimage
jondaley at devel.plogworld.net
jondaley at devel.plogworld.net
Wed Mar 30 18:37:34 GMT 2005
Author: jondaley
Date: 2005-03-30 18:37:33 +0000 (Wed, 30 Mar 2005)
New Revision: 1653
Modified:
plugins/trunk/authimage/pluginauthimage.class.php
Log:
check for function before calling, since it might not exist
Modified: plugins/trunk/authimage/pluginauthimage.class.php
===================================================================
--- plugins/trunk/authimage/pluginauthimage.class.php 2005-03-30 18:18:32 UTC (rev 1652)
+++ plugins/trunk/authimage/pluginauthimage.class.php 2005-03-30 18:37:33 UTC (rev 1653)
@@ -93,11 +93,14 @@
$encrypt = $this->encrypt($code, $this->key);
$background = AUTHIMAGE_BACKGROUND_FOLDER.$this->default;
$tempFile = $this->cacheFolder."/".$encrypt.".gif";
-
- if ( !function_exists ( 'imagecreatefromgif' ) ) {
+
+ if(function_exists ( 'imagecreatefromgif' )){
+ $image = @imagecreatefromgif($background) or die("Cannot Initialize new GD image stream");
+ }
+ else if(function_exists ( 'imagecreatefrompng' )){
$image = @imagecreatefrompng($background) or die("Cannot Initialize new GD image stream");
} else {
- $image = @imagecreatefromgif($background) or die("Cannot Initialize new GD image stream");
+ die("Server doesn't support GIF or PNG creation. Sorry.");
}
$textColor = imageColorAllocate($image, 0x00, 0x00, 0x00);
@@ -108,11 +111,10 @@
} else {
ImageGIF($image, $tempFile);
}
-
$temp = fopen($tempFile,"rb");
$buffer = fread($temp,filesize($tempFile));
fclose($temp);
-
+
// Now zero-length the file. No need for its content anymore.
$temp = fopen($tempFile,"w");
fwrite($temp, NULL);
@@ -154,4 +156,4 @@
}
}
-?>
\ No newline at end of file
+?>
More information about the pLog-svn
mailing list