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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access