From 96cc83a6e0fa3dcee3da5ec4e8e7103828698d32 Mon Sep 17 00:00:00 2001 From: Egon Schmid Date: Mon, 13 Mar 2000 18:42:16 +0000 Subject: [PATCH] Looks now nicer and more correct. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@21495 c90b9560-bf6c-de11-be94-00142212c4b1 --- functions/image.xml | 1095 ++++++++++++++++++++++++++----------------- 1 file changed, 666 insertions(+), 429 deletions(-) diff --git a/functions/image.xml b/functions/image.xml index dd0bd2ab7e..598b5ae448 100644 --- a/functions/image.xml +++ b/functions/image.xml @@ -4,23 +4,28 @@ - You can use the image functions in PHP to get the size of JPEG, - GIF, and PNG images, and if you have the GD library (available at - &url.gd;) you will also be able to - create and manipulate images. + You can use the image functions in PHP to get the size of + JPEG, GIF, and + PNG images, and if you have the + GD library (available at &url.gd;) you will also be able to create + and manipulate images. + GetImageSize - get the size of a GIF, JPG or PNG image + Get the size of a GIF, JPEG or PNG image Description array getimagesize string filename - array imageinfo + array + imageinfo + The GetImageSize function will determine the @@ -28,8 +33,8 @@ PNG image file and return the dimensions along with the file type and a height/width text string to be used inside a normal HTML IMG - tag. - + tag. + Returns an array with 4 elements. Index 0 contains the width of the image in pixels. Index 1 contains the height. Index 2 a flag @@ -38,44 +43,48 @@ string that can be used directly in an IMG tag. GetImageSize - -<?php $size = GetImageSize("img/flag.jpg"); ?> + +<?php $size = GetImageSize ("img/flag.jpg"); ?> <IMG SRC="img/flag.jpg" <?php echo $size[3]; ?>> - - + + + The optional imageinfo parameter allows you to extract some extended information from the image file. Currently this will return the diffrent JPG APP markers in an associative Array. Some Programs use these APP markers to embedd text information in - images. A very common one in to embed IPTC &url.iptc; information in the APP13 - marker. You can use the iptcparse function - to parse the binary APP13 marker into something readable. + images. A very common one in to embed IPTC + &url.iptc; information in the + APP13 marker. You can use the iptcparse + function to parse the binary APP13 marker into something + readable. GetImageSize returning IPTC - + <?php - $size = GetImageSize("testimg.jpg",&$info); - if (isset($info["APP13"])) { - $iptc = iptcparse($info["APP13"]); - var_dump($iptc); + $size = GetImageSize ("testimg.jpg",&$info); + if (isset ($info["APP13"])) { + $iptc = iptcparse ($info["APP13"]); + var_dump ($iptc); } ?> - - - + + + + This function does not require the GD image library. - - + + + ImageArc - draw a partial ellipse + Draw a partial ellipse Description @@ -91,19 +100,21 @@ int col - ImageArc draws a partial ellipse centered at cx, cy (top left is - 0,0) in the image represented by im. w and h specifies the - ellipse's width and height respectively while the start and end - points are specified in degrees indicated by the s and e - arguments. - + ImageArc draws a partial ellipse centered at + cx, cy (top left is + 0, 0) in the image represented by im. W + and h specifies the ellipse's width and + height respectively while the start and end points are specified + in degrees indicated by the s and + e. arguments. + ImageChar - draw a character horizontally + Draw a character horizontally Description @@ -117,22 +128,24 @@ int col - ImageChar draws the first character of c - in the image identified by id with its - upper-left at x,y - (top left is 0,0) with the color col. If - font is 1, 2, 3, 4 or 5, a built-in font is used (with higher - numbers corresponding to larger fonts). + ImageChar draws the first character of + c in the image identified by + id with its upper-left at + x,y (top left is 0, + 0) with the color col. If font is 1, 2, 3, + 4 or 5, a built-in font is used (with higher numbers + corresponding to larger fonts). + - See also imageloadfont. - + See also imageloadfont. + ImageCharUp - draw a character vertically + Draw a character vertically Description @@ -146,19 +159,23 @@ int col - ImageCharUp draws the character c vertically in the image - identified by im at coordinates x, y (top left is 0, 0) with the - color col. If font is 1, 2, 3, 4 or 5, a built-in font is - used. + ImageCharUp draws the character + c vertically in the image identified by + im at coordinates + x, y (top left is + 0, 0) with the color col. If font is 1, + 2, 3, 4 or 5, a built-in font is used. + - See also imageloadfont. + See also imageloadfont. + ImageColorAllocate - allocate a color for an image + Allocate a color for an image Description @@ -170,22 +187,27 @@ int blue - ImageColorAllocate returns a color identifier representing the - color composed of the given RGB components. The im argument is - the return from the imagecreate function. - ImageColorAllocate must be called to create each color that is to - be used in the image represented by im. - -$white = ImageColorAllocate($im, 255,255,255); -$black = ImageColorAllocate($im, 0,0,0); - + ImageColorAllocate returns a color + identifier representing the color composed of the given + RGB components. The im + argument is the return from the imagecreate + function. ImageColorAllocate must be called + to create each color that is to be used in the image represented + by im. + + +$white = ImageColorAllocate ($im, 255, 255, 255); +$black = ImageColorAllocate ($im, 0, 0, 0); + + + ImageColorAt - get the index of the color of a pixel + Get the index of the color of a pixel Description @@ -197,17 +219,21 @@ $black = ImageColorAllocate($im, 0,0,0); Returns the index of the color of the pixel at the - specified location in the image. + specified location in the image. + See also imagecolorset and - imagecolorsforindex. + imagecolorsforindex. + ImageColorClosest - get the index of the closest color to the specified color + + Get the index of the closest color to the specified color + Description @@ -219,21 +245,24 @@ $black = ImageColorAllocate($im, 0,0,0); int blue - Returns the index of the color in the palette of the image - which is "closest" to the specified RGB value. + Returns the index of the color in the palette of the image which + is "closest" to the specified RGB value. + The "distance" between the desired color and each color in the - palette is calculated as if the RGB values represented points in - three-dimensional space. + palette is calculated as if the RGB values + represented points in three-dimensional space. + - See also imagecolorexact. + See also imagecolorexact. + ImageColorExact - get the index of the specified color + Get the index of the specified color Description @@ -246,19 +275,25 @@ $black = ImageColorAllocate($im, 0,0,0); Returns the index of the specified color in the palette of the - image. + image. + If the color does not exist in the image's palette, -1 is - returned. + returned. + - See also imagecolorclosest. + See also imagecolorclosest. + ImageColorResolve - get the index of the specified color or its closest possible alternative + + Get the index of the specified color or its closest possible + alternative + Description @@ -272,16 +307,20 @@ $black = ImageColorAllocate($im, 0,0,0); This function is guaranteed to return a color index for a requested color, either the exact color or the closest possible - alternative. + alternative. + - See also imagecolorclosest. + See also imagecolorclosest. + ImageColorSet - set the color for the specified palette index + + Set the color for the specified palette index + Description @@ -297,16 +336,18 @@ $black = ImageColorAllocate($im, 0,0,0); This sets the specified index in the palette to the specified color. This is useful for creating flood-fill-like effects in paletted images without the overhead of performing the actual - flood-fill. + flood-fill. + - See also imagecolorat. + See also imagecolorat. + ImageColorsForIndex - get the colors for an index + Get the colors for an index Description @@ -318,17 +359,21 @@ $black = ImageColorAllocate($im, 0,0,0); This returns an associative array with red, green, and blue keys that contain the appropriate values for the specified color - index. + index. + See also imagecolorat and - imagecolorexact. + imagecolorexact. + ImageColorsTotal - find out the number of colors in an image's palette + + Find out the number of colors in an image's palette + Description @@ -337,40 +382,49 @@ $black = ImageColorAllocate($im, 0,0,0); int im - This returns the number of colors in the specified image's palette. + This returns the number of colors in the specified image's + palette. + See also imagecolorat and - imagecolorsforindex. + imagecolorsforindex. + ImageColorTransparent - define a color as transparent + Define a color as transparent Description int imagecolortransparent int im - int col + int + col + - ImageColorTransparent sets the transparent color in the im image - to col. im is the image identifier returned by - imagecreate and col is a color identifier - returned by imagecolorallocate. + ImageColorTransparent sets the transparent + color in the im image to + col. Im is the + image identifier returned by ImageCreate and + col is a color identifier returned by + ImageColorAllocate. + The identifier of the new (or current, if none is specified) - transparent color is returned. + transparent color is returned. + ImageCopyResized - copy and resize part of an image + Copy and resize part of an image Description @@ -388,8 +442,8 @@ $black = ImageColorAllocate($im, 0,0,0); int srcH - ImageCopyResized copies a rectangular portion of one image to - another image. dst_im is the destination + ImageCopyResized copies a rectangular portion of one image to + another image. Dst_im is the destination image, src_im is the source image identifier. If the source and destination coordinates and width and heights differ, appropriate stretching or shrinking of the @@ -397,14 +451,15 @@ $black = ImageColorAllocate($im, 0,0,0); upper left corner. This function can be used to copy regions within the same image (if dst_im is the same as src_im) but if the regions overlap - the results will be unpredictable. + the results will be unpredictable. + ImageCreate - create a new image + Create a new image Description @@ -413,16 +468,18 @@ $black = ImageColorAllocate($im, 0,0,0); int x_size int y_size - - ImageCreate returns an image identifier representing a blank - image of size x_size by y_size. + + ImageCreate returns an image identifier + representing a blank image of size x_size + by y_size. + ImageCreateFromGif - create a new image from file or URL + Create a new image from file or URL Description @@ -431,42 +488,49 @@ $black = ImageColorAllocate($im, 0,0,0); string filename - imagecreatefromgif returns an image identifier - representing the image obtained from the given filename. + ImageCreateFromGif returns an image identifier + representing the image obtained from the given filename. + - imagecreatefromgif returns an empty string + ImageCreateFromGif returns an empty string on failure. It also outputs an error message, which unfortunately displays as a broken link in a browser. To ease debugging the following example will produce an error GIF: - Example to handle an error during creation (courtesy vic@zymsys.com ) - -function LoadGif($imgname) -{ - $im = @imagecreatefromgif($imgname); /* Attempt to open */ - if ($im == "") { /* See if it failed */ - $im = ImageCreate(150,30); /* Create a blank image */ - $bgc = ImageColorAllocate($im,255,255,255); - $tc = ImageColorAllocate($im,0,0,0); - ImageFilledRectangle($im,0,0,150,30,$bgc); - ImageString($im,1,5,5,"Error loading $imgname",$tc); /* Output an errmsg */ - } - return $im; + + Example to handle an error during creation (courtesy + vic@zymsys.com) + + +function LoadGif ($imgname) { + $im = @imagecreatefromgif ($imgname); /* Attempt to open */ + if ($im == "") { /* See if it failed */ + $im = ImageCreate (150, 30); /* Create a blank image */ + $bgc = ImageColorAllocate ($im, 255, 255, 255); + $tc = ImageColorAllocate ($im, 0, 0, 0); + ImageFilledRectangle ($im, 0, 0, 150, 30, $bgc); + /* Output an errmsg */ + ImageString($im, 1, 5, 5, "Error loading $imgname", $tc); + } + return $im; } - - - - Since all GIF support was removed from the GD library in version 1.6, - this function is not available if you are using that version of the - GD library. - + + + + + Since all GIF support was removed from the GD library in + version 1.6, this function is not available if you are using + that version of the GD library. + + + - + - ImageCreateFromJpeg - create a new image from file or URL + ImageCreateFromJPEG + Create a new image from file or URL Description @@ -475,36 +539,42 @@ function LoadGif($imgname) string filename - imagecreatefromjpeg returns an image identifier - representing the image obtained from the given filename. + ImageCreateFromJPEG returns an image identifier + representing the image obtained from the given filename. + - imagecreatefromjpeg returns an empty string + ImagecreateFromJPEG returns an empty string on failure. It also outputs an error message, which unfortunately displays as a broken link in a browser. To ease debugging the - following example will produce an error JPEG: + following example will produce an error JPEG: - Example to handle an error during creation (courtesy vic@zymsys.com ) - -function LoadJpeg($imgname) -{ - $im = @imagecreatefromjpeg($imgname); /* Attempt to open */ - if ($im == "") { /* See if it failed */ - $im = ImageCreate(150,30); /* Create a blank image */ - $bgc = ImageColorAllocate($im,255,255,255); - $tc = ImageColorAllocate($im,0,0,0); - ImageFilledRectangle($im,0,0,150,30,$bgc); - ImageString($im,1,5,5,"Error loading $imgname",$tc); /* Output an errmsg */ - } - return $im; + + Example to handle an error during creation (courtesy + vic@zymsys.com ) + + +function LoadJpeg ($imgname) { + $im = @imagecreatefromjpeg ($imgname); /* Attempt to open */ + if ($im == "") { /* See if it failed */ + $im = ImageCreate (150, 30); /* Create a blank image */ + $bgc = ImageColorAllocate ($im, 255, 255, 255); + $tc = ImageColorAllocate ($im, 0, 0, 0); + ImageFilledRectangle ($im, 0, 0, 150, 30, $bgc); + /* Output an errmsg */ + ImageString ($im, 1, 5, 5, "Error loading $imgname", $tc); + } + return $im; } - + + + ImageCreateFromPNG - create a new image from file or URL + Create a new image from file or URL Description @@ -513,35 +583,42 @@ function LoadJpeg($imgname) string filename - imagecreatefrompng returns an image identifier - representing the image obtained from the given filename. + ImageCreateFromPNG returns an image identifier + representing the image obtained from the given filename. + - imagecreatefrompng returns an empty string + ImageCreateFromPNG returns an empty string on failure. It also outputs an error message, which unfortunately displays as a broken link in a browser. To ease debugging the - following example will produce an error PNG: - - Example to handle an error during creation (courtesy vic@zymsys.com ) - -function LoadPNG($imgname) -{ - $im = @imagecreatefrompng($imgname); /* Attempt to open */ - if ($im == "") { /* See if it failed */ - $im = ImageCreate(150,30); /* Create a blank image */ - $bgc = ImageColorAllocate($im,255,255,255); - $tc = ImageColorAllocate($im,0,0,0); - ImageFilledRectangle($im,0,0,150,30,$bgc); - ImageString($im,1,5,5,"Error loading $imgname",$tc); /* Output an errmsg */ - } - return $im; + following example will produce an error PNG: + + + Example to handle an error during creation (courtesy + vic@zymsys.com) + + +function LoadPNG ($imgname) { + $im = @imagecreatefrompng ($imgname); /* Attempt to open */ + if ($im == "") { /* See if it failed */ + $im = ImageCreate (150, 30); /* Create a blank image */ + $bgc = ImageColorAllocate ($im, 255, 255, 255); + $tc = ImageColorAllocate ($im, 0, 0, 0); + ImageFilledRectangle ($im, 0, 0, 150, 30, $bgc); + /* Output an errmsg */ + ImageString ($im, 1, 5, 5, "Error loading $imgname", $tc); + } + return $im; } - + + + + ImageDashedLine - draw a dashed line + Draw a dashed line Description @@ -555,17 +632,22 @@ function LoadPNG($imgname) int col - ImageLine draws a dashed line from x1,y1 to x2,y2 (top left is - 0,0) in image im of color col. + ImageDashedLine draws a dashed line from + x1, y1 to + x2, y2 (top left is + 0, 0) in image im of color + col. + - See also imageline. + See also ImageLine. + ImageDestroy - destroy an image + Destroy an image Description @@ -574,16 +656,18 @@ function LoadPNG($imgname) int im - ImageDestroy frees any memory associated with image im. im is - the image identifier returned by the - imagecreate function. + ImageDestroy frees any memory associated + with image im. Im + is the image identifier returned by the + ImageCreate function. + ImageFill - flood fill + Flood fill Description @@ -595,15 +679,18 @@ function LoadPNG($imgname) int col - ImageFill performs a flood fill starting at coordinate x, y (top - left is 0,0) with color col in the image im. + ImageFill performs a flood fill starting at + coordinate x, y + (top left is 0, 0) with color col in the + image im. + ImageFilledPolygon - draw a filled polygon + Draw a filled polygon Description @@ -615,17 +702,20 @@ function LoadPNG($imgname) int col - ImageFilledPolygon creates a filled polygon in image im. points - is a PHP array containing the polygon's vertices, ie. points[0] = - x0, points[1] = y0, points[2] = x1, points[3] = y1, etc. - num_points is the total number of vertices. + ImageFilledPolygon creates a filled polygon + in image im. + Points is a PHP array containing the + polygon's vertices, ie. points[0] = x0, points[1] = y0, points[2] + = x1, points[3] = y1, etc. Num_points is + the total number of vertices. + ImageFilledRectangle - draw a filled rectangle + Draw a filled rectangle Description @@ -639,17 +729,21 @@ function LoadPNG($imgname) int col - ImageFilledRectangle creates a filled rectangle of color col in - image im starting at upper left coordinates x1, y1 and ending at - bottom right coordinates x2, y2. 0, 0 is the top left corner of - the image. + ImageFilledRectangle creates a filled + rectangle of color col in image + im starting at upper left coordinates + x1, y1 and ending + at bottom right coordinates x2, + y2. 0, 0 is the top left corner of the + image. + ImageFillToBorder - flood fill to specific color + Flood fill to specific color Description @@ -662,16 +756,19 @@ function LoadPNG($imgname) int col - ImageFillToBorder performs a flood fill whose border color is - defined by border. The starting point for the fill is x,y (top - left is 0,0) and the region is filled with color col. + ImageFillToBorder performs a flood fill + whose border color is defined by border. + The starting point for the fill is x, + y (top left is 0, 0) and the region is + filled with color col. + ImageFontHeight - get font height + Get font height Description @@ -680,17 +777,19 @@ function LoadPNG($imgname) int font - Returns the pixel height of a character in the specified font. + Returns the pixel height of a character in the specified font. + - See also imagefontwidth and - imageloadfont. + See also ImageFontWidth and + ImageLoadFont. + ImageFontWidth - get font width + Get font width Description @@ -699,108 +798,127 @@ function LoadPNG($imgname) int font - Returns the pixel width of a character in font. + Returns the pixel width of a character in font. + - See also imagefontheight and - imageloadfont. + See also ImageFontHeight and + ImageLoadFont. + - ImageGif - output image to browser or file + ImageGIF + Output image to browser or file Description int imagegif int im - string filename + string + filename + - imagegif creates the GIF file in filename - from the image im. The + ImageGIF creates the GIF + file in filename from the image im. The im argument is the return from the - imagecreate function. + imagecreate function. + - The image format will be GIF87a unless the image has been made - transparent with imagecolortransparent, in - which case the image format will be GIF89a. + The image format will be GIF87a unless the + image has been made transparent with + ImageColorTransparent, in which case the + image format will be GIF89a. + The filename argument is optional, and if left off, the raw image stream will be output directly. By sending an image/gif content-type using header, you can create a - PHP script that outputs GIF images directly. - - - Since all GIF support was removed from the GD library in version - 1.6, this function is not available if you are using that - version of the GD library. - - + PHP script that outputs GIF images directly. + + + Since all GIF support was removed from the + GD library in version 1.6, this function is + not available if you are using that version of the GD library. + + + - ImageJpeg - output image to browser or file + ImageJPEG + Output image to browser or file Description int imagejpeg int im - string filename - int quality + string + filename + + int + quality + - imagejpeg creates the JPEG file in filename - from the image im. The - im argument is the return from the - imagecreate function. + ImageJPEG creates the + JPEG file in filename from the image + im. The im argument + is the return from the ImageCreate function. + The filename argument is optional, and if left off, the raw image - stream will be output directly. To skip the filename argument in order - to provide a quality argument just use an empty string (''). By sending - an image/jpg content-type using header, you can create a - PHP script that outputs JPEG images directly. - - - JPEG support is only available in PHP if PHP was compiled against GD-1.8 - or later. - - + stream will be output directly. To skip the filename argument in + order to provide a quality argument just use an empty string + (''). By sending an image/jpg content-type using + header, you can create a PHP script that + outputs JPEG images directly. + + + JPEG support is only available in PHP if PHP was compiled + against GD-1.8 or later. + + + ImageInterlace - enable or disable interlace + Enable or disable interlace Description int imageinterlace int im - int interlace + int + interlace + ImageInterlace turns the interlace bit on or off. If interlace is 1 the im image will be interlaced, and if interlace - is 0 the interlace bit is turned off. + is 0 the interlace bit is turned off. + This functions returns whether the interlace bit is set for the - image. + image. + ImageLine - draw a line + Draw a line Description @@ -814,18 +932,22 @@ function LoadPNG($imgname) int col - ImageLine draws a line from x1,y1 to x2,y2 (top left is 0,0) in - image im of color col. + ImageLine draws a line from + x1, y1 to + x2, y2 (top left is + 0, 0) in image im of color col. + - See also imagecreate and - imagecolorallocate. + See also ImageCreate and + ImageColorAllocate. + ImageLoadFont - load a new font + Load a new font Description @@ -834,71 +956,72 @@ function LoadPNG($imgname) string file - ImageLoadFont loads a user-defined bitmap font and returns an - identifier for the font (that is always greater than 5, so it - will not conflict with the built-in fonts). + ImageLoadFont loads a user-defined bitmap + font and returns an identifier for the font (that is always + greater than 5, so it will not conflict with the built-in fonts). + The font file format is currently binary and architecture dependent. This means you should generate the font files on the - same type of CPU as the machine you are running PHP on. + same type of CPU as the machine you are running PHP on. + Font file format - - byte position - C data type - description - + + byte position + C data type + description + - - byte 0-3 - int - number of characters in the font - - - byte 4-7 - int - - value of first character in the font (often 32 for space) - - - - byte 8-11 - int - pixel width of each character - - - byte 12-15 - int - pixel height of each character - - - byte 16- - char - - array with character data, one byte per pixel in each - character, for a total of (nchars*width*height) bytes. - - - + + byte 0-3 + int + number of characters in the font + + + byte 4-7 + int + + value of first character in the font (often 32 for space) + + + + byte 8-11 + int + pixel width of each character + + + byte 12-15 + int + pixel height of each character + + + byte 16- + char + + array with character data, one byte per pixel in each + character, for a total of (nchars*width*height) bytes. + + -
- + + See also ImageFontWidth and - ImageFontHeight. - + ImageFontHeight. +
ImagePolygon - draw a polygon + Draw a polygon Description @@ -910,19 +1033,25 @@ function LoadPNG($imgname) int col - ImagePolygon creates a polygon in image id. points is a PHP - array containing the polygon's vertices, ie. points[0] = x0, - points[1] = y0, points[2] = x1, points[3] = y1, etc. num_points - is the total number of vertices. - - See also imagecreate. + ImagePolygon creates a polygon in image id. + Points is a PHP array containing the + polygon's vertices, ie. points[0] = x0, points[1] = y0, points[2] + = x1, points[3] = y1, etc. Num_points is + the total number of vertices. + + + See also imagecreate. + ImagePSBBox - give the bounding box of a text rectangle using PostScript Type1 fonts + + Give the bounding box of a text rectangle using PostScript Type1 + fonts + Description @@ -936,31 +1065,38 @@ function LoadPNG($imgname) float angle - size is expressed in pixels. + Size is expressed in pixels. + - space allows you to change the default + Space allows you to change the default value of a space in a font. This amount is added to the normal - value and can also be negative. + value and can also be negative. + tightness allows you to control the amount of white space between characters. This amount is added to the - normal character width and can also be negative. + normal character width and can also be negative. + - angle is in degrees. + Angle is in degrees. + Parameters space and tightness are expressed in character space - units, where 1 unit is 1/1000th of an em-square. + units, where 1 unit is 1/1000th of an em-square. + Parameters space, - tightness and angle - are optional. + tightness, and angle + are optional. + The bounding box is calculated using information available from character metrics, and unfortunately tends to differ slightly from the results achieved by actually rasterizing the text. If the angle is 0 degrees, you can expect the text to need 1 pixel - more to every direction. + more to every direction. + This function returns an array containing the following elements: @@ -984,9 +1120,11 @@ function LoadPNG($imgname) - + + - See also imagepstext. + See also imagepstext. + @@ -997,7 +1135,9 @@ permits to find a solution. ImagePSCopyFont - make a copy of an already loaded font for further modification + + Make a copy of an already loaded font for further modification + Description @@ -1010,20 +1150,24 @@ permits to find a solution. font, for example extending/condensing, slanting it or changing it's character encoding vector, but need to keep the original along as well. Note that the font you want to copy must be one - obtained using imagepsloadfont, not a font + obtained using ImagePSLoadFont, not a font that is itself a copied one. You can although make modifications - to it before copying. + to it before copying. + If you use this function, you must free the fonts obtained this way yourself and in reverse order. Otherwise - your script will hang. + your script will hang. + In the case everything went right, a valid font index will be returned and can be used for further purposes. Otherwise the function returns false and prints a message describing what went - wrong. + wrong. + - See also imageploadpsfont. + See also ImagePSLoadFont. + --> @@ -1031,7 +1175,9 @@ permits to find a solution. ImagePSEncodeFont - change the character encoding vector of a font + + Change the character encoding vector of a font + Description @@ -1046,20 +1192,22 @@ permits to find a solution. definitely want to change this if you use an other language than english. The exact format of this file is described in T1libs documentation. T1lib comes with two ready-to-use files, - IsoLatin1.enc and IsoLatin2.enc. + IsoLatin1.enc and IsoLatin2.enc. + If you find yourself using this function all the time, a much better way to define the encoding is to set ps.default_encoding in the configuration file to point to the right encoding file and all fonts you load will - automatically have the right encoding. + automatically have the right encoding. + ImagePSFreeFont - free memory used by a PostScript Type 1 font + Free memory used by a PostScript Type 1 font Description @@ -1068,14 +1216,15 @@ permits to find a solution. int fontindex - See also imagepsloadfont. + See also ImagePSLoadFont. + ImagePSLoadFont - load a PostScript Type 1 font from file + Load a PostScript Type 1 font from file Description @@ -1087,16 +1236,20 @@ permits to find a solution. In the case everything went right, a valid font index will be returned and can be used for further purposes. Otherwise the function returns false and prints a message describing what went - wrong. + wrong. + - See also imagepsfreefont. + See also ImagePSFreeFont. + ImagePSText - to draw a text string over an image using PostScript Type1 fonts + + To draw a text string over an image using PostScript Type1 fonts + Description @@ -1110,57 +1263,79 @@ permits to find a solution. int background int x int y - int - space - int - tightness - float - angle - int - antialias_steps + int + + space + + + int + + tightness + + + float + + angle + + + int + + antialias_steps + + - size is expressed in pixels. + Size is expressed in pixels. + - foreground is the color in which the text - will be painted. background is the color + Foreground is the color in which the text + will be painted. Background is the color to which the text will try to fade in with antialiasing. No pixels with the color background are actually painted, so the background image does not need to be of - solid color. + solid color. + The coordinates given by x, y will define the origin (or reference point) of the first character (roughly the lower-left corner of the character). This is different from the - ImageString, where x, y define the - upper-right corner of the first character. Refer to PostScipt - documentation about fonts and their measuring system if you have - trouble understanding how this works. + ImageString, where x, + y define the upper-right corner of the + first character. Refer to PostScipt documentation about fonts and + their measuring system if you have trouble understanding how this + works. + - space allows you to change the default + Space allows you to change the default value of a space in a font. This amount is added to the normal - value and can also be negative. + value and can also be negative. + - tightness allows you to control the amount + Tightness allows you to control the amount of white space between characters. This amount is added to the - normal character width and can also be negative. + normal character width and can also be negative. + - angle is in degrees. + Angle is in degrees. + - antialias_steps allows you to control the + Antialias_steps allows you to control the number of colours used for antialiasing text. Allowed values are 4 and 16. The higher value is recommended for text sizes lower than 20, where the effect in text quality is quite visible. With - bigger sizes, use 4. It's less computationally intensive. + bigger sizes, use 4. It's less computationally intensive. + Parameters space and tightness are expressed in character space - units, where 1 unit is 1/1000th of an em-square. + units, where 1 unit is 1/1000th of an em-square. + Parameters space, tightness, angle - and antialias are optional. + and antialias are optional. + This function returns an array containing the following elements: @@ -1186,14 +1361,15 @@ permits to find a solution. - See also imagepsbbox. + See also imagepsbbox. + ImageRectangle - draw a rectangle + Draw a rectangle Description @@ -1207,17 +1383,18 @@ permits to find a solution. int col - ImageRectangle creates a rectangle of color col in image im - starting at upper left coordinate x1,y1 and ending at bottom - right coordinate x2,y2. 0,0 is the top left corner of the - image. + ImageRectangle creates a rectangle of color + col in image im starting at upper left coordinate x1, y1 and + ending at bottom right coordinate x2, y2. 0, 0 is the top left + corner of the image. + ImageSetPixel - set a single pixel + Set a single pixel Description @@ -1229,17 +1406,22 @@ permits to find a solution. int col - ImageSetPixel draws a pixel at x,y (top left is 0,0) in image im - of color col. See also - imagecreate and - imagecolorallocate. + ImageSetPixel draws a pixel at + x, y (top left is + 0, 0) in image im of color + col. + + + See also ImageCreate and + ImageColorAllocate. + ImageString - draw a string horizontally + Draw a string horizontally Description @@ -1253,17 +1435,23 @@ permits to find a solution. int col - ImageString draws the string s in the image identified by im at - coordinates x,y (top left is 0,0) in color col. If font is 1, 2, - 3, 4 or 5, a built-in font is used. See also - imageloadfont. + ImageString draws the string + s in the image identified by + im at coordinates + x, y (top left is + 0, 0) in color col. If font is 1, 2, 3, 4 + or 5, a built-in font is used. + + + See also ImageLoadFont. + ImageStringUp - draw a string vertically + Draw a string vertically Description @@ -1277,17 +1465,23 @@ permits to find a solution. int col - ImageStringUp draws the string s vertically in the image - identified by im at coordinates x,y (top left is 0,0) in color - col. If font is 1, 2, 3, 4 or 5, a built-in font is used. - See also imageloadfont. + ImageStringUp draws the string + s vertically in the image identified by + im at coordinates + x, y (top left is + 0, 0) in color col. If font is 1, 2, 3, 4 + or 5, a built-in font is used. + + + See also ImageLoadFont. + ImageSX - get image width + Get image width Description @@ -1295,17 +1489,21 @@ permits to find a solution. int imagesx int im - - ImageSX returns the width of the image identified by im. - See also imagecreate and - imagesy. + + ImageSX returns the width of the image + identified by im. + + + See also ImageCreate and + ImageSY. + ImageSY - get image height + Get image height Description @@ -1314,21 +1512,27 @@ permits to find a solution. int im - ImageSY returns the height of the image identified by im. - See also imagecreate and - imagesx. + ImageSY returns the height of the image + identified by im. + + + See also ImageCreate and + ImageSX. + ImageTTFBBox - give the bounding box of a text using TypeType fonts + + Give the bounding box of a text using TypeType fonts + Description - array ImageTTFBBox + array imagettfbbox int size int angle string fontfile @@ -1336,32 +1540,49 @@ permits to find a solution. This function calculates and returns the bounding box in pixels - a TrueType text. + for a TrueType text. - text - The string to be measured. + + text + + + The string to be measured. + - size - The font size. + + size + + + The font size. + - fontfile - The name of the TrueType font file. (Can - also be an URL.) + + fontfile + + + + The name of the TrueType font file. (Can also be an URL.) + + - angle - Angle in degrees in which - text will be measured. + + angle + + + + Angle in degrees in which text will be + measured. + + - ImageTTFBBox returns an array with 8 elements representing four points making the bounding box of the text: - @@ -1402,24 +1623,29 @@ permits to find a solution. The points are relative to the text regardless of the angle, so "upper left" means in the top - left-hand corner seeing the text horizontallty. + left-hand corner seeing the text horizontallty. + - This function requires both the GD library and the Freetype - library. + This function requires both the GD library and the FreeType + library. + - See also ImageTTFText. + See also ImageTTFText. + ImageTTFText - write text to the image using TrueType fonts + + Write text to the image using TrueType fonts + Description - array ImageTTFText + array imagettftext int im int size int angle @@ -1430,64 +1656,75 @@ permits to find a solution. string text - ImageTTFText draws the string text in the - image identified by im, starting at - coordinates x,y (top left is 0,0), at an - angle of angle in color + ImageTTFText draws the string + text in the image identified by + im, starting at coordinates + x, y (top left is + 0, 0), at an angle of angle in color col, using the TrueType font file - identified by fontfile. + identified by fontfile. + - The coordinates given by - x,y will define the - basepoint of the first character (roughly the lower-left corner - of the character). This is different from the - ImageString, where x,y define the - upper-right corner of the first character. + The coordinates given by x, + y will define the basepoint of the first + character (roughly the lower-left corner of the character). This + is different from the ImageString, where x, + y define the upper-right corner of the first character. + - angle is in degrees, with 0 degrees being + Angle is in degrees, with 0 degrees being left-to-right reading text (3 o'clock direction), and higher values representing a counter-clockwise rotation. (i.e., a value - of 90 would result in bottom-to-top reading text). + of 90 would result in bottom-to-top reading text). + - fontfile is the path to the TrueType font - you wish to use. + Fontfile is the path to the TrueType font + you wish to use. + - text is the text string which may include - UTF-8 character sequences (of the form: &#123; ) to access - characters in a font beyond the first 255. + Text is the text string which may include + UTF-8 character sequences (of the form: &#123;) to access + characters in a font beyond the first 255. + - col is the color index. Using the + Col is the color index. Using the negative of a color index has the effect of turning off - antialiasing. + antialiasing. + ImageTTFText returns an array with 8 elements representing four points making the bounding box of the text. The order of the points is upper left, upper right, lower right, lower left. The points are relative to the text regardless of the angle, so "upper left" means in the top - left-hand corner when you see the text horizontallty. + left-hand corner when you see the text horizontallty. + This example script will produce a black GIF 400x30 pixels, with the words "Testing..." in white in the font Arial. ImageTTFText - + <?php -Header("Content-type: image/gif"); -$im = imagecreate(400,30); -$black = ImageColorAllocate($im, 0,0,0); -$white = ImageColorAllocate($im, 255,255,255); -ImageTTFText($im, 20, 0, 10, 20, $white, "/path/arial.ttf", "Testing... Omega: &#937;"); -ImageGif($im); -ImageDestroy($im); +Header ("Content-type: image/gif"); +$im = imagecreate (400, 30); +$black = ImageColorAllocate ($im, 0, 0, 0); +$white = ImageColorAllocate ($im, 255, 255, 255); +ImageTTFText ($im, 20, 0, 10, 20, $white, "/path/arial.ttf", + "Testing... Omega: &#937;"); +ImageGif ($im); +ImageDestroy ($im); ?> - - + + + This function requires both the GD library and the FreeType library. + url="&url.freetype;">FreeType library. + - See also ImageTTFBBox. + See also ImageTTFBBox. + @@ -1503,7 +1740,7 @@ sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil -sgml-default-dtd-file:"../manual.ced" +sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil