Creating a Simple Image
For the first example in this chapter, you'll create a simple image: text on a colored background. To be able to do so, you will only need use of the GD, zlib, and either the JPEG or PNG libraries, depending upon which format you want to create. Most installations of PHP should not have difficulty with the following script.
Making images with PHP is straightforward: You begin the process, you paint your picture, then you send the image to the Web browser (the images in the first three sections of the chapter will be created in memory and sent to the Web browser; the images in the final section will be saved on the server). It all starts with the imagecreate() function, which takes the width and height of the image, in ...
Get PHP Advanced for the World Wide Web: Visual QuickPro Guide 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.