|
Posted by Rik on 08/08/06 16:48
alfred.ayache@gmail.com wrote:
> I've found a problem with many of my PHP installations. I'm not sure
> whether it's a PHP problem, or an Apache problem, or something else
> again.
>
> The issue appears when we try to use the following snippet from the
> PHP docs for imagecreate():
>
> <?php
> header("Content-type: image/png");
> $im = @imagecreate(100, 50)
> or die("Cannot Initialize new GD image stream");
> $background_color = imagecolorallocate($im, 255, 255, 255);
> $text_color = imagecolorallocate($im, 233, 14, 91);
> imagestring($im, 1, 5, 5, "A Simple Text String", $text_color);
> imagepng($im);
> imagedestroy($im);
>>
>
> This brings up an empty page. FF Page Info shows a 0px x 0px png.
> I'm using Win2K on 2 of my 3 machines. On the 3rd, XP machine I'm
> using xampp which uses Apache 2, and it works on that one.
What if you move the header bit, and try to view the php file directly?
Sending a header before any errors may be outputted can screw up your
possibility to see the errors.
<?php
$im = @imagecreate(100, 50)
or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 255, 255, 255);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, "A Simple Text String", $text_color) or
die('Cannot create text');
header("Content-type: image/png");
imagepng($im);
imagedestroy($im);
?>
It works here BTW, without problems.
Could you maybe give us the GD bit's of phpinfo() from the different
servers?
(here:
GD Support enabled
GD Version bundled (2.0.28 compatible)
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.1.9
T1Lib Support enabled
GIF Read Support enabled
GIF Create Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
XBM Support enabled)
Grtz,
--
Rik Wasmus
Navigation:
[Reply to this message]
|