What is the GD library? GD library is an extension of PHP graphics processing library. GD library provides a series of API for processing images. You can use GD library to process pictures, or generate pictures, and you can also add watermarks to pictures. 1. Edit the PHP configuration file and set extension_dir=' directory where ext resides'. 2. Open extension=php_gd2.dll with extension=php_gd2.dll and remove the semicolon. 3. Restart the server. How do I use the GD library? Create a Canvas -- Assign Colors -- Start Drawing -- Tell the Page Game browser to display the image -- Output the image or Save -- Destroy the resource
Create the page game canvas
imagecreatetruecolor($width, $height); $imageChar ($image, $font, $x, $y, $c, $color); $color = "imagestring($image, $font, $x, $y, $string, $color)"; $string, $color); $string, $color); $string, $color; The header('www.pizei.comcontent-type:image/ PNG ') is displayed as a PNG; Render the header(' Content-type :image/ GIF ') as a GIF;
The bold
The GD library generates CAPTCHAs to generate random colors using MT_rang (0,255); The ImageFilledRectangle ($image, $x1, $y1, $x2, $y2, $color) method is used. Image creates the canvas variable Font Size 1,2,3,4, 5, x1,y1 Position (top left corner of image 0, 0) x2,y2 Fill the rectangle Width and Height Color Assignment Color Variables where you need to set ImagetFText to modify the font of the output text