Pay attention to a problem I encountered.
Png images created with the PHP function seems to be very badly recognised by old browsers, especially -well, mainly - by IE 4.0 (crash of the browser).
I think this is probably due to the fact that, when IE 4.0 was released, the png format was either very recent, either not very used, because of the widespread jpeg and gif formats...
So, if you plan to dynamically create images for a web site to be seen by IE 4.0 users, think of it...
May'be the jpeg format will do the job better.

doesnt ruin the image but adds display to the output.this will generate an image with a random color. if you like it you can use it because you have the RBG result too.<?phpheader("content-type:image/png");$im = imagecreate(100, 100);$a = sprintf('%04x',mt_rand(0, 65535));$b = sprintf('%04x',mt_rand(0, 65535));$c = sprintf('%04x',mt_rand(0, 65535));$white = imagecolorallocate($im,$a,$b,$c);imagepng($im);imagedestroy($im);echo "\n\n\n$a-$b-$c";?>

When you get undefined function image* it means the gd library isnt being used. Check the php.ini file. Make sure the php_gd.dll isnt commented out. Restarting apache should result in the image functions working.

GD UPGRADE PROBLEM:I used imagecreate with gd 1.6 to make resized images of big photos. Then, when using the same script on gd 2.0, the colors got all wrong.Using imagecreatetruecolor() fixed the problem!

Don't try and create an image with a really large width and/or height. First, $width x $height is (at least) the bytes of memory that need to be allocated. Secondly, if you exceed the range of int for either parameter, Apache crashes (before allocating any memory).Don't ask how I figured this out ;)

Dont forget to use ImageDestoy after showed image. I forgot it, my webpage had about 15 pictures what was generated by GD and webserver died very fastly (server was Dual Xeon 900MHz and 4G RAM :[[ ). It died cos of not enough memory :\

How I fixed my "undefined function imagecreate()" problem:
I was having the same problem many have reported where most of PHP worked but the gd functions didn't. I'd installed the RedHat rpm php-4.0.1pl2. It said (phpinfo.php) that it had been configured with the '--with-gd=shared' option. In my /usr/lib directory, I had both libgd.so.1.8.3 and libgd.a. I decided to compile with the static library instead, so I downloaded the sources and built with all the same configuration flags except that I used --with-gd=/usr. Now my gd library works!!!

This is how you can create a thumbnail with maximum height and width. This way it will fit nicely in a gallery table. In this example $im is the source image<?//calculate thumb size$ow = imagesx($im);$oh = imagesy($im);$maxh = 100;$maxw = 150; $new_h = $oh;$new_w = $ow;