O'Reilly logo

Core PHP Programming: Using PHP to Build Dynamic Web Sites by Leon Atkinson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating JPEG, PNG, and WBMP Images

All the functions in this section require the GD library. If you haven't compiled it as part of your PHP module, either load it automatically by editing php3.ini, or use the dl function. Some of these functions also require other libraries, which allow you to use font files.

To get started you can use either imagecreate to start with a blank graphic, or a function such as imagecreatefrompng to load a PNG from a file. Coordinates in these functions treat (0, 0) to be the top-left corner and refer to pixels. Likewise, any size arguments refer to pixels.

When creating images with these functions, you can't simply decide to output an image in the middle of a script that outputs HTML. You must create a separate ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required