Working with Text
In this section we will work primarily with PHP’s TrueType functions, which are useful for creating sophisticated charts or navigation. For a quick and easy way of writing to an image, however, the imagestring() function is the perfect tool.
Writing to an Image with the imagestring() Function
The imagestring() function is simple and useful. It requires an image resource, a font number, an x-axis location, and a y-axis location (with location 0,0 being the upper-left corner of the image). The function also requires the string you want to output and a color resource. Of these arguments, only the font numbers should need much explanation. These are built-in fonts of ascending size. Font 1 is the smallest in size, font 2 is slightly ...
Get Sams Teach Yourself PHP in 24 Hours, Third Edition 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.