Can someone give me a basic template for putting text on top of a png and/or gif image that already exists?
If you use Imagick, http://valokuva.org/?cat=1 has some tutorials on different things including how to annotate images.
Alternatively, PHP's GD-Lib-based [man]image[/man] functions provide some examples of using text with images.