Hello,

While loking for some problem with a gallery package, I just encounter a 
strange behaviour of apache2/libgd2, please have a look to the test program I 
used : 


tata.php :

<?php
  header ("Content-type: image/png");
 $im = @imagecreate(2500, 1000)
    or die ("Cannot use GD");
 $background_color = imagecolorallocate ($im, 255, 255, 255);
 $text_color = imagecolorallocate ($im, 233, 14, 91);
 imagestring ($im, 1, 5, 5,  "A Very Simple test ", $text_color);
 imagepng ($im);

?>

titi.php :
 <?php
  header ("Content-type: image/png");
 $im = @imagecreatetruecolor(2500, 1000)
    or die (" Cannot use GD");
 $background_color = imagecolorallocate ($im, 255, 255, 255);
 $text_color = imagecolorallocate ($im, 233, 14, 91);
 imagestring ($im, 1, 5, 5,  "A Very Simple test ", $text_color);
 imagepng ($im);

?>

et enfin 

toto.php :
 <?php
  header ("Content-type: image/png");
if (function_exists('imagecreatetruecolor'))
{
 $im = @imagecreatetruecolor(2500, 1000)
    or die ("Cannot use GD");
 $background_color = imagecolorallocate ($im, 255, 255, 255);
 $text_color = imagecolorallocate ($im, 233, 14, 91);
 imagestring ($im, 1, 5, 5,  "A Very Simple test ", $text_color);
 imagepng ($im);
}

else {
$im = @imagecreate(2500, 1000)
    or die ("Cannot use lib GD");
  $background_color = imagecolorallocate ($im, 255, 255, 255);
  $text_color = imagecolorallocate ($im, 233, 14, 91);
  imagestring ($im, 1, 5, 5,  "A Very Simple test ", $text_color);
  imagepng ($im);
}
?>

And now if I run the progs, the output are  : 

[EMAIL PROTECTED] temp]$ php -f tata.php
PNG
▒
IHDR    
ÄèÀ£ý}PLTEÿÿÿé[Ë£ÁIDATxíÒ!nÂ`ÆáÙÚLmÑL`j0KÝŠm³+ì»Ã5▒nÁEv&KŸ4{üòæþÔCQGcU<ånÔ×]Ì,7VêïíÇë°ZìϹ[Š¥ì
 
»k^6շϺÛÛÏs3l/¹[Š%u×¶œëtªr·LNÑE»ÿå/Æå7ßIEND®B`

(it is png picture)

[EMAIL PROTECTED] temp]$ php -f titi.php
[EMAIL PROTECTED] temp]$

and:

[EMAIL PROTECTED] temp]$ php -f toto.php
[EMAIL PROTECTED] temp]$

The programs titi.php and toto.php have no output and I just get an empty file 
if the direct them to a file.


If I change a little bit  toto.php, we can check that the function :
if (function_exists('imagecreatetruecolor'))
returns TRUE .

If I change the test case in toto to : 
if (function_exists('imagecreatetruecolor') && @imagecreatetruecolor(0,0)) 
the program is using the imagecreate function 

php info returns: 
PHP Version 4.3.3

and lib   gd
GD Support      enabled 

GD Version      bundled (2.0.15 compatible) 

FreeType Support        enabled 

FreeType Linkage        with freetype 

GIF Read Support        enabled 

JPG Support             enabled 

PNG Support             enabled 

WBMP Support            enabled 

XBM Support             enabled 

and finally : 
[EMAIL PROTECTED] php]# rpm -qa | grep apache
apache2-2.0.47-5mdk
apache2-common-2.0.47-5mdk
apache2-modules-2.0.47-5mdk
apache2-mod_php-2.0.47_4.3.2-2mdk
apache-conf-2.0.47-5mdk

[EMAIL PROTECTED] php]# rpm -qa | grep libgd
libgdbm2-1.8.0-24mdk
libgd2-2.0.15-3mdk
libgdk-pixbuf-gnomecanvas1-0.22.0-2mdk
libgda2.0_1-0.91.0-1mdk
libgdk-pixbuf2-0.22.0-2mdk
libgdk_pixbuf2.0_0-2.2.4-1mdk
[EMAIL PROTECTED] php]#

(almost uptodate cooker)

Please advise on that 

Thanks for your help 


Laurent

-- 
Laurent Saint-Michel
Email (quand il marche) [EMAIL PROTECTED]


Reply via email to