PHP Developer’s Dictionary IT-SC book 550 } return $image; imagecreatefrompng() Syntax int imagecreatefrompng(string location) Description The imagecreatefrompng() function, which was added in PHP 3.0.13, returns an image identifier for the PNG image at location , which can be a filename or URL. If the process fails, the function returns an error message. To avoid this, you can use the following type of code in which you create an image if the one you seek is not there: $image = imagecreatefrompng("myimage.png"); if(!$image){ // check for error $image = imagecreate(1, 1); // create blank image $background = imagecolorallocate($image, 0, 0, 0); // white imagefill($image, 0, 0, $background); // create white image } return $image; imagedashedline() Syntax int imagedashedline(int image, int x_1, int y_1, int x_2, int y_2, int color) Description The imagedashedline() function draws a dashed color line from x_1 , y_1 to x_2 , y_2 on image . imagedestroy() Syntax PHP Developer’s Dictionary IT-SC book 551 int imagedestroy(int image) Description The imagedestroy() function frees any memory (destroys in the PHP runtime) associated with image . imagefill() Syntax int imagefill(int image, int x, int y, int color) Description The imagefill() function fills image with color starting at x and y and continuing for the rest of the image. imagefilledpolygon() Syntax int imagefilledpolygon(int image, array points, int num_points, int color ) Description The imagefilledpolygon() function fills the location defined by points and num_points of the image with a polygon of color . The points parameter is an array containing the polygon's vertices (that is, points[0] = x0 , points[1] = y0 , points[2] = x1 , points[3] = y1 , and so on) and num_points is the total number of vertices. imagefilledrectangle() Syntax int imagefilledrectangle(int image, int x_1, int y_1, int x_2, int y_2, int color) PHP Developer’s Dictionary IT-SC book 552 Description The imagefilledrectangle() function fills a rectangle in image with color starting at x_1 and y_1 and continuing to x_2 and y_2 . imagefilltoborder() Syntax int imagefilltoborder(int image, int x, int y, int border_color, int color) Description The imagefilltoborder() function fills image , starting at x and y , with color and continues until it hits border_color . imagefontheight() Syntax int imagefontheight(int font) Description The imagefontheight() function returns the pixel height of a character in font . imagefontwidth() Syntax int imagefontwidth(int font) Description The imagefontwidth() function returns the pixel width of a character in font . imagegif() Syntax PHP Developer’s Dictionary IT-SC book 553 int imagegif(int image [, string filename]) Description The imagegif() function creates a GIF87a image referenced by image . The optional filename enables you to save the file to disk if you do not want to send it out directly in a stream to the browser. If you do want to do this, you must set the content-type HTTP header directive to image/gif by using the header() function. imagepng() Syntax int imagepng(int image [, string filename]) Description The imagepng() function, which was added in PHP 3.0.13, creates a PNG image referenced by image . The optional filename enables you to save the file to disk if you do not want to send it out directly in a stream to the browser. If you do want to do this, you must set the content-type HTTP header directive to image/png by using the header() function. imagejpeg() Syntax int imagejpeg(int image [, string filename [, int quality]]) Description The imagejpeg() function creates a JPEG image referenced by image . The optional filename enables you to save the file to disk if you do not want to send it out directly in a stream to the browser. If you do want to do this, you must set the content-type HTTP header directive to image/jpeg by using the header() function. Optionally, you can specify a value from 0 to 100 for the quality parameter. imageinterlace() Syntax PHP Developer’s Dictionary IT-SC book 554 int imageinterlace(int image [, int interlace]) Description The imageinterlace() function turns the interlace bit on or off in image . The function toggles the bit unless you use the optional interlace parameter, which when set equal to 1 turns on the bit, and when set to 0 turns off the bit. imageline() Syntax int imageline(int image, int x_1, int y_1, int x_2, int y_2, int color) Description The imageline() function draws a color line from x_1 , y_1 to x_2 , y_2 on image . imageloadfont() Syntax int imageloadfont(string font) Description The imageloadfont() function loads a user-defined, bitmap font . The function returns an identifier that is always greater than 5 so that it does not conflict with the built-in fonts. Because the format is binary and architecture dependent, you should generate the font files on the same type of CPU as the machine on which you are running PHP. imagepolygon() Syntax int imagepolygon(int image, array points, int num_points, int color) Description . imagedestroy() Syntax PHP Developer’s Dictionary IT-SC book 551 int imagedestroy(int image) Description The imagedestroy() function frees any memory (destroys in the PHP runtime) associated. imagecreatefrompng(string location) Description The imagecreatefrompng() function, which was added in PHP 3.0.13, returns an image identifier for the PNG image at location , which can be a filename. PHP Developer’s Dictionary IT-SC book 550 } return $image; imagecreatefrompng() Syntax