[nycphp-talk] PHP GD problems
Ken Robinson
kenrbnsn at rbnsn.com
Thu Jul 13 10:39:35 EDT 2006
At 10:23 AM 7/13/2006, Andrew Kamm wrote:
>Still having problems -- I tried moving the
>header(), but it gave me the 'headers already sent' error.
>
>However, having gone back to the original code
>and removing the '@', my Linux server did
>provide a header error and a bunch of goofy
>characters (the Windows box still gives "The
>image "..." cannot be displayed because it has
>errors"). Oddly, the header call is the absolute
>first thing on the script (and again -- no
>there's no white space prior to the <?php tag).
>
>Here's what I'm using right now:
>
><?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);
>?>
>
>Here's what the Linux box is spitting out:
>
>Warning: Cannot modify header information -
>headers already sent by (output started at
>/home/.../public_html/test.php:1) in /home/.../public_html/test.php on line 2
>�PNG
What is at line 11 of
/home/.../public_html/test.php? How are you
invoking this script? The "funny" characters are
the PNG image being displayed as ASCII.
Ken
More information about the talk
mailing list