tailieunhanh - PHP and MySQL Web Development - P84

PHP and MySQL Web Development - P84: PHP and MySQL Web Development teaches the reader to develop dynamic, secure, commercial Web sites. Using the same accessible, popular teaching style of the first edition, this best-selling book has been updated to reflect the rapidly changing landscape of MySQL and PHP. | 19 Generating Images NE OF THE USEFUL THINGS YOU CAN do with PHP is create images on-the-fly. PHP has some built-in image information functions and you can also use the gd library to create new images or manipulate existing ones. This chapter discusses how to use the image functions to achieve some interesting and useful effects. We will look at Setting up image support in PHP Understanding image formats Creating images Using text and fonts to create images Drawing figures and graphing data Specifically we ll look at two examples generating Web site buttons on-the-fly and drawing a bar chart using figures from a MySQL database. Setting Up Image Support in PHP Image support in PHP is available via the gd library available from http gd From PHP PHP comes with its own version of the gd library supported by the PHP team. This version has extra features and is usually more up-to-date so it s advisable to use this version. With some earlier versions of PHP you have a choice of using the gd or gd2 library We recommend you use gd2 as it is more stable. Under Windows PNGs and JPEGs are automatically supported. If you have Unix and want to work with PNGs you will need to install libpng and zlib from the following places respectively 388 Chapter 19 Generating Images http pub png http zlib You will then need to configure PHP with the following options --with-png-dir path to libpng --with-zlib-dir path to zlib If you have UNIX and want to work with JPEGs you will need to download jpeg-6b and recompile gd with jpeg support can download this from ftp graphics jpeg You will then need to reconfigure PHP with the --with-jpeg-dir path to jpeg-6b option and recompile it. If you want to use TrueType fonts in your images you will also need the FreeType library. This also comes with PHP 4. Alternatively you can download this from http If you want to use PostScript Type 1 fonts instead you will need .

TỪ KHÓA LIÊN QUAN