LinuxGeex.Myhosting.Info: Painless Cloud Storage
Articles Colour-Key, Box-Warp, Non-Linear Gradient, Transparency... May 12th 2011

Gorgeous, reusable graphics are just a few clicks away with PHP/GD.

These techniques can be a little heavy on the server, so make sure you use server-side caching (EAccelerator, MemCached, etc) and/or proxying to lighten the load. Here's some examples of what can be done.

It may seem odd, but this is actually the first PHP project I ever wrote. I had to fix a problem with a PHP installation which involved a bug in GD. I had never used PHP or GD before, and after fixing the bug I was intrigued by what was possible with the functions I saw.

Here's some with different gradient backgrounds. You can leave the background transparent, or make it a flat fill too, but that would be boring. ;-)

small button red small button green small button blue small button cyan on shelf big button with wide corners

Above and below, here's two with different border sizes. This is achieved by stretching the center of the image and then scaling it down. As you can see, the text can have multiple rows and be applied with a rotation. Standard stuff there.

big button with narrow corners

These images are all generated real-time, BTW

big button with rainbow background

Above, one with a less colourful fill so you can see the nice glassy transparancy. Below, the granddaddy of them all. I created it in Inkscape.

plain PNG file

Of course, there are no ColourKey or BoxWarping functions in GD. I wrote those in pure (and quite optimal) PHP. This code is now 5 years old. CSS3 is slowly making them doable client-side, I have used it very little in my day to day work, so I will be open-sourcing it in the near future. Stay tuned!

Powered by jEdit 4.3.2, the Programmer's Editor. Powered by SiteWrapper 1.0.1, the ultralight PHP CMS. Powered by LG Solutions, the web design professionals