Re: Test libGD -> Very strange!
| From: | Vincent M. | Date: | Thu, 10 Apr 2003 23:54:29 +0000 |
| Subject: | Re: Test libGD -> Very strange! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-143407@lists.php.net to get a copy of this message | ||
Vincent M. wrote:
Hello,
I do this to test the version of lib gd installed on the server:
if( (function_exists("imagecreatetruecolor")) &&
(function_exists("imagecopyresampled")) ) {
$out = imagecreatetruecolor( $s0x, $s0y) ;
imagecopyresampled ($out, $pic, 0, 0, 0, 0, $s0x, $s0y, $sizex, $sizey) ;
}else {
$out = imagecreate( $s0x, $s0y) ;
imagecopyresized($out, $pic, 0, 0, 0, 0, $s0x, $s0y, $sizex, $sizey) ;
}
And even if the lib gd is in version 1, it enters in the if and output the following insult:
Fatal error: imagecreatetruecolor(): requires GD 2.0 or later in index.php on line 22
Why it enters in the if, why does the function exist if the function is not available ?
Any idea to test if the functions imagecreatetruecolor and imagecopyresampled are available ?
Thanks,
Vincent.
ok, I've found a solution but it might not be the most optimized one:
if(@imagecreatetruecolor(0,0)) {
$out = imagecreatetruecolor( $s0x, $s0y) ;
imagecopyresampled ($out, $pic, 0, 0, 0, 0, $s0x, $s0y, $sizex, $sizey) ;
}else {
$out = imagecreate( $s0x, $s0y) ;
imagecopyresized($out, $pic, 0, 0, 0, 0, $s0x, $s0y, $sizex, $sizey) ;
}
Any other idea ?
Thanks.