![]() |
|
Boutells GD-Library essentials - GD PART I
The one thing I've had most fun with in php this far, is the GD-lib. I guess the reason is the ease with wich rather spectacular results are made. To begin lightly, I'll show just how to make a .php-document act as an image and how to show that.
In this above case, dot_image.php does nothing more than set headers as image, read the image into a variable followed by outputting it. This does however leave us with the option of interacting with the image between those two occurences. So what can we do with a image that's read into php? (in this case a 24-bit PNG as I've found them to give the best results with GD)
A complete list of the features available can be found at http://www.php.net/manual/en/ref.image.php Below, I'll just show you how to use floodfills by HTTP GET argumentswhen calling images (you know, adding the document.php?x=y directive) - doing nothing but reuesting the image by different querystrings.
This above example floodfills the image with any of the four selected colors upon request. On links below you can see this for yourself, just keep in mind the image originates from the same source - fill color is applied programatically. I'd say it's quite cool ^^
Green fill Red fill Blue fill Yellow fill Seems I'm crap with images at times, this image looks like shit after it's filled ... and it's not supposed to. Dunno what I did wrong. Bleh! |