Image Creation with PHP
 
SEARCH: webmonkey  the web

 
PHP
-------------------------
Print
this article for free. 
-------------------------

Pages:
1  Scripting Can Be Fun!
2 Holding It All Together
3 Create the Ellipse
4 Now for Something More Shapely
5 Modify an Existing Image

Image Creation with PHP
by Brad Bulger 17 Jun 1999

Brad Bulger [an error occurred while processing this directive]has done many things for Wired over the years that he'd rather not go into right now. He wants to know when the future is going to get here.

Page 1

So far in Webmonkey, you've seen how PHP can be used for databasing and site navigation. It's pretty bland. In this article we're going to leave that dry stuff behind and concentrate on PHP's image-creation abilities.

Sometimes it's good to use images for your form's Submit button and for other links on your page. That way you can control their size and appearance. Maintenance can be a pain, though. PHP, as we'll see, can make it a bit easier.

The image functions in PHP will let you build GIF images on the fly, either out of pure code or by building on an existing image. We'll look at both possibilities here.

Take a look at this example. Input your own text in the form and see how it works. You'll notice that the images reflect the text you entered in the form. If the banner the monkey holds doesn't get updated with the other images, you may have to force an image reload.

Let's walk through most of the code to see how this is done. I'll start by looking at the main file here, button.phtml.

next page»