Discover the PHP GD Library.

The other day a giant 800 page PHP book managed to lure me in. I started flipping around and I found a chapter on the GD Library. The GD Library is an open source code library for the dynamic creation of images by programmers. For some time now I’ve been wanting to learn all about what this library has to offer and how we can find practical uses for it in our Content Management System Catalyst here at Visual Lizard.

I started off by creating little yellow Pacman characters randomly placed all over the board. Don’t forget to refresh page once its loaded.
View Result | View Source

I then created random number of circles and connected them from one to another.
View Result | View Source

Something then clicked inside of my brain that if I incrementally increase the x by  60 pixels then I can get it to somewhat represent a graph with random y values.
View Result | View Source

Based on simple percentages you can easily generate a pie chart. Here’s a picture of my first pie chart:
View Result | View Source

I found some open source code  and here’s what I manged to whip up from it:
View Source


While I may be no Joshua Davis or Eric Natzke, who both had incredible presentations at FITC Winnipeg last year, I managed to whip up some of my own randomly generated PHP art. What I did below is simply created a random number of polygons with random co-ordinates and  colours:

I like to call this "php art"

View Result | View Source

I even manged to whipe up the visual lizard logo in ascii coloured number signs:
View Result | View Source

My conclusion from this is that the GD library is an excellent method for creating graphicaly representations. When it comes to art... Well I’ll keep working on that.

to blog