Understanding the Image-Creation Process

Creating an image with PHP is not like creating an image with a drawing program: There's no pointing and clicking or dragging buckets of color into a predefined space to fill your image. Similarly, there's no Save As functionality, in which your drawing program automatically creates a GIF or JPEG or PNG (and so on) just because you ask it to do so.

Instead, you have to become the drawing application. As the programmer, you must create each step along the way in your PHP script. You are responsible for using the individual PHP functions to define colors, draw and fill shapes, size and resize the image, and save the image as a specific file type. It's not as difficult as it might seem, however, if you understand ...

Get Sams Teach Yourself PHP, MySQL® and Apache All in One now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.