by using the php image functions of course!
Any more details please ?
I once made something like this back when Chuck Norris was big stuff. It took a Chuck Norris fact from a website, broke it up so it would fit on the picture, then posted it on the picture. Here's the code (It doesn't quite work anymore because the guy changed his website, rendering my quote-grabbing code useless. Everything else is A-OK, though):
Hope the example helps!