Jwang,
First let's verify your installation of gd in PHP.
For Windows, check the following:
1.) Be sure that you have downloaded and installed the Windows zip package from
http://www.php.net/downloads.php which includes many of the extra PHP extensions, including gd, if you used the Windows Installer extra extensions were not included, no worries though, just download the above package and move all the extra stuff in it to your PHP directory. But if you're running PHP as an Apache module you've likely already downloaded this package... check the following php.ini settings...
2.) Open php.ini (C:\Windows\php.ini) on a windows system.
Uncomment the line..
extension=php_gd2.dll
Modify the following line to point to the extensions directory.
extension_dir = "C:\PHP\extensions\"
For Linux:
See the gd documentation available at
http://www.php.net/gd for configuration options.
Restart Apache and run the following script:
<?php
phpinfo();
?>
If you see the gd heading followed by a list of gd configurations, then the install was successful.
<?php
header("content-type: image/png");
$im = @ImageCreate(150, 150) or die("Could not create image");
$bg_color = ImageColorAllocate($im, 240, 240, 240);
$text_color = ImageColorAllocate($im, 0, 0, 0);
ImageRectangle($im, 40, 40, 140, 140, $text_color);
ImageString($im, 3, 5, 5, "Square", $text_color);
ImagePng($im);
ImageDestroy($im);
?>
This code looks ok to me. What errors or warnings do you see when you run it? (Ran independently of anything else, e.g. not from within the 'src' attribute of an img tag.)
Also it doesn't make sense to suppress errors in an experimental script, remove the '@' error supression operator from the call to ImageCreate().
: )
Rich
:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::