Unless you actually use fopen to write an image, it will most definatelly not write the image to your server.
If you want to dive into this, check the following page.
http://nl.php.net/manual/en/function.imagecreatetruecolor.phpon the left, you can see all the GD2 commands. (oh yeah, GD2 library has to be installed, but I found it to be installed 9 out of 10 times.
You can also use imagecreate, but the difference is, that imagecreate is only limited to 256 colors, which can look bad if you start to get the hang of it, and are using backgrounds.
It really is a matter of copy/paste to get this script.
I bet you can write an image with text in about 10 commands.
First create the image, then set the colors, then write text, then print the headers, then print the image, then destroy the image to free up memory.
The example from imagecreate already gives you a working image.