On Ozh's site, FrenchFragFactory.net, today, there's this handy little post dealing with the creation of gradients in PHP with the help of GD.
Disclaimer : there are probably existing alternatives or classes, maybe in PEAR. I didn't check. I wanted to write a function myself, as part of my GD training grounds.
Here is a small PHP function I wrote that emulates a gradient fill of an image.
The script is simple enough, and only uses four different variable values to make the patterns. There are a few examples of the end result in the form of a basic square output, but (as he mentions) it can be used just as easily in other situations. The source code is availible in either plain-text or in a .phps style file.