mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 16:38:54 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@9477 c90b9560-bf6c-de11-be94-00142212c4b1
1338 lines
48 KiB
Text
1338 lines
48 KiB
Text
|
|
<reference id="ref.image">
|
|
<title>Image functions</title>
|
|
<titleabbrev>Graphics</titleabbrev>
|
|
|
|
<partintro>
|
|
<simpara>
|
|
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 <ulink
|
|
url="&url.gd;">&url.gd;</ulink>) you will also be able to create and
|
|
manipulate GIF images.
|
|
</partintro>
|
|
|
|
<refentry id="function.getimagesize">
|
|
<refnamediv>
|
|
<refname>GetImageSize</refname>
|
|
<refpurpose>get the size of a GIF, JPG or PNG image</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>array <function>getimagesize</function></funcdef>
|
|
<paramdef>string <parameter>filename</parameter></paramdef>
|
|
<paramdef>array <parameter><optional>imageinfo</optional></parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
The <function>GetImageSize</function> function will determine the
|
|
size of any <acronym>GIF</acronym>, <acronym>JPG</acronym> or
|
|
<acronym>PNG</acronym> image file and return the dimensions along
|
|
with the file type and a height/width text string to be used
|
|
inside a normal <acronym>HTML</acronym> <sgmltag>IMG</sgmltag>
|
|
tag.
|
|
|
|
<para>
|
|
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
|
|
indicating the type of the image. 1 = GIF, 2 = JPG, 3 = PNG.
|
|
Index 3 is a text string with the correct "height=xxx width=xxx"
|
|
string that can be used directly in an IMG tag.
|
|
<example>
|
|
<title>GetImageSize</title>
|
|
<programlisting>
|
|
<?php $size = GetImageSize("img/flag.jpg"); ?>
|
|
<IMG SRC="img/flag.jpg" <?php echo $size[3]; ?>>
|
|
</programlisting></example>
|
|
|
|
<para>
|
|
The optional <parameter>imageinfo</parameter> parameter allows you to
|
|
extract some extended information from the image file. Currently this
|
|
will return the diffrent <acronym>JPG</acronym> 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 <ulink
|
|
url="&url.iptc;">&url.iptc;</ulink> information in the APP13 marker. You
|
|
can use the <function>iptcparse</function> function to parse the binary
|
|
APP13 marker into something readable.
|
|
<example>
|
|
<title>GetImageSize returning IPTC</title>
|
|
<programlisting>
|
|
<?php
|
|
$size = GetImageSize("testimg.jpg",&$info);
|
|
if (isset($info["APP13"])) {
|
|
$iptc = iptcparse($info["APP13"]);
|
|
var_dump($iptc);
|
|
}
|
|
?>
|
|
</programlisting></example>
|
|
|
|
<note><simpara>
|
|
This function does not require the GD image library.
|
|
</simpara></note>
|
|
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagearc">
|
|
<refnamediv>
|
|
<refname>ImageArc</refname>
|
|
<refpurpose>draw a partial ellipse</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>imagearc</function></funcdef>
|
|
<paramdef>int <parameter>im</parameter></paramdef>
|
|
<paramdef>int <parameter>cx</parameter></paramdef>
|
|
<paramdef>int <parameter>cy</parameter></paramdef>
|
|
<paramdef>int <parameter>w</parameter></paramdef>
|
|
<paramdef>int <parameter>h</parameter></paramdef>
|
|
<paramdef>int <parameter>s</parameter></paramdef>
|
|
<paramdef>int <parameter>e</parameter></paramdef>
|
|
<paramdef>int <parameter>col</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
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.
|
|
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagechar">
|
|
<refnamediv>
|
|
<refname>ImageChar</refname>
|
|
<refpurpose>draw a character horizontally</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>imagechar</function></funcdef>
|
|
<paramdef>int <parameter>im</parameter></paramdef>
|
|
<paramdef>int <parameter>font</parameter></paramdef>
|
|
<paramdef>int <parameter>x</parameter></paramdef>
|
|
<paramdef>int <parameter>y</parameter></paramdef>
|
|
<paramdef>string <parameter>c</parameter></paramdef>
|
|
<paramdef>int <parameter>col</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
ImageChar draws the first character of <parameter>c</parameter> in the image
|
|
identified by <parameter>id</parameter> with its upper-left at
|
|
<parameter>x</parameter>,<parameter>y</parameter> (top left is 0,0) with the
|
|
color <parameter>col</parameter>. If font is 1, 2, 3, 4 or 5, a built-in font is
|
|
used (with higher numbers corresponding to larger fonts).
|
|
<para>
|
|
See also <function>imageloadfont</function>.
|
|
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagecharup">
|
|
<refnamediv>
|
|
<refname>ImageCharUp</refname>
|
|
<refpurpose>draw a character vertically</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>imagecharup</function></funcdef>
|
|
<paramdef>int <parameter>im</parameter></paramdef>
|
|
<paramdef>int <parameter>font</parameter></paramdef>
|
|
<paramdef>int <parameter>x</parameter></paramdef>
|
|
<paramdef>int <parameter>y</parameter></paramdef>
|
|
<paramdef>string <parameter>c</parameter></paramdef>
|
|
<paramdef>int <parameter>col</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para> 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.
|
|
<para> See also <function>imageloadfont</function>.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagecolorallocate">
|
|
<refnamediv>
|
|
<refname>ImageColorAllocate</refname>
|
|
<refpurpose>allocate a color for an image</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>imagecolorallocate</function></funcdef>
|
|
<paramdef>int <parameter>im</parameter></paramdef>
|
|
<paramdef>int <parameter>red</parameter></paramdef>
|
|
<paramdef>int <parameter>green</parameter></paramdef>
|
|
<paramdef>int <parameter>blue</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
ImageColorAllocate returns a color identifier representing the color composed of
|
|
the given RGB components. The im argument is the return from the
|
|
<function>imagecreate</function> function. ImageColorAllocate must be called to
|
|
create each color that is to be used in the image represented by im.
|
|
<informalexample><programlisting>
|
|
$white = ImageColorAllocate($im, 255,255,255);
|
|
$black = ImageColorAllocate($im, 0,0,0);
|
|
</programlisting></informalexample>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagecolortransparent">
|
|
<refnamediv>
|
|
<refname>ImageColorTransparent</refname>
|
|
<refpurpose>define a color as transparent</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>imagecolortransparent</function></funcdef>
|
|
<paramdef>int <parameter>im</parameter></paramdef>
|
|
<paramdef>int <parameter><optional>col</optional></parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
ImageColorTransparent sets the transparent color in the im image
|
|
to col. im is the image identifier returned by <function>imagecreate</function>
|
|
and col is a color identifier returned by
|
|
<function>imagecolorallocate</function>.
|
|
<para>
|
|
The identifier of the new (or current, if none is specified) transparent
|
|
color is returned.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagecopyresized">
|
|
<refnamediv>
|
|
<refname>ImageCopyResized</refname>
|
|
<refpurpose>copy and resize part of an image</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>imagecopyresized</function></funcdef>
|
|
<paramdef>int <parameter>dst_im</parameter></paramdef>
|
|
<paramdef>int <parameter>src_im</parameter></paramdef>
|
|
<paramdef>int <parameter>dstX</parameter></paramdef>
|
|
<paramdef>int <parameter>dstY</parameter></paramdef>
|
|
<paramdef>int <parameter>srcX</parameter></paramdef>
|
|
<paramdef>int <parameter>srcY</parameter></paramdef>
|
|
<paramdef>int <parameter>dstW</parameter></paramdef>
|
|
<paramdef>int <parameter>dstH</parameter></paramdef>
|
|
<paramdef>int <parameter>srcW</parameter></paramdef>
|
|
<paramdef>int <parameter>srcH</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
ImageCopyResized copies a rectangular portion of one image to
|
|
another image. <parameter>dst_im</parameter> is the destination
|
|
image, <parameter>src_im</parameter> is the source image
|
|
identifier. If the source and destination coordinates and width
|
|
and heights differ, appropriate stretching or shrinking of the
|
|
image fragment will be performed. The coordinates refer to the
|
|
upper left corner. This function can be used to copy regions
|
|
within the same image (if <parameter>dst_im</parameter> is the
|
|
same as <parameter>src_im</parameter>) but if the regions overlap
|
|
the results will be unpredictable.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagecreate">
|
|
<refnamediv>
|
|
<refname>ImageCreate</refname>
|
|
<refpurpose>create a new image</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>imagecreate</function></funcdef>
|
|
<paramdef>int <parameter>x_size</parameter></paramdef>
|
|
<paramdef>int <parameter>y_size</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para> ImageCreate returns an image identifier representing a blank image
|
|
of size x_size by y_size.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagecreatefromgif">
|
|
<refnamediv>
|
|
<refname>ImageCreateFromGif</refname>
|
|
<refpurpose>create a new image from file or URL</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>imagecreatefromgif</function></funcdef>
|
|
<paramdef>string <parameter>filename</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para> ImageCreateFromGif returns an image identifier representing the
|
|
image obtained from the given filename.
|
|
<para>
|
|
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>
|
|
<title>Example to handle an error during creation (courtesy vic@zymsys.com )</title>
|
|
<programlisting role=php>
|
|
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;
|
|
}
|
|
</programlisting></example>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagedashedline">
|
|
<refnamediv>
|
|
<refname>ImageDashedLine</refname>
|
|
<refpurpose>draw a dashed line</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>imagedashedline</function></funcdef>
|
|
<paramdef>int <parameter>im</parameter></paramdef>
|
|
<paramdef>int <parameter>x1</parameter></paramdef>
|
|
<paramdef>int <parameter>y1</parameter></paramdef>
|
|
<paramdef>int <parameter>x2</parameter></paramdef>
|
|
<paramdef>int <parameter>y2</parameter></paramdef>
|
|
<paramdef>int <parameter>col</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para> ImageLine draws a dashed line from x1,y1 to
|
|
x2,y2 (top left is
|
|
0,0) in image im of color
|
|
col.
|
|
<para> See also <function>imageline</function>.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagedestroy">
|
|
<refnamediv>
|
|
<refname>ImageDestroy</refname>
|
|
<refpurpose>destroy an image</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>imagedestroy</function></funcdef>
|
|
<paramdef>int <parameter>im</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para> ImageDestroy frees any memory associated with image im. im is the
|
|
image identifier returned by the <function>imagecreate</function>
|
|
function.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagefill">
|
|
<refnamediv>
|
|
<refname>ImageFill</refname>
|
|
<refpurpose>flood fill</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>imagefill</function></funcdef>
|
|
<paramdef>int <parameter>im</parameter></paramdef>
|
|
<paramdef>int <parameter>x</parameter></paramdef>
|
|
<paramdef>int <parameter>y</parameter></paramdef>
|
|
<paramdef>int <parameter>col</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para> ImageFill performs a flood fill starting at coordinate x, y (top left is 0,0) with color col in the image im.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagefilledpolygon">
|
|
<refnamediv>
|
|
<refname>ImageFilledPolygon</refname>
|
|
<refpurpose>draw a filled polygon</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>imagefilledpolygon</function></funcdef>
|
|
<paramdef>int <parameter>im</parameter></paramdef>
|
|
<paramdef>array <parameter>points</parameter></paramdef>
|
|
<paramdef>int <parameter>num_points</parameter></paramdef>
|
|
<paramdef>int <parameter>col</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para> 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.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagefilledrectangle">
|
|
<refnamediv>
|
|
<refname>ImageFilledRectangle</refname>
|
|
<refpurpose>draw a filled rectangle</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>imagefilledrectangle</function></funcdef>
|
|
<paramdef>int <parameter>im</parameter></paramdef>
|
|
<paramdef>int <parameter>x1</parameter></paramdef>
|
|
<paramdef>int <parameter>y1</parameter></paramdef>
|
|
<paramdef>int <parameter>x2</parameter></paramdef>
|
|
<paramdef>int <parameter>y2</parameter></paramdef>
|
|
<paramdef>int <parameter>col</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para> 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.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagefilltoborder">
|
|
<refnamediv>
|
|
<refname>ImageFillToBorder</refname>
|
|
<refpurpose>flood fill to specific color</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>imagefilltoborder</function></funcdef>
|
|
<paramdef>int <parameter>im</parameter></paramdef>
|
|
<paramdef>int <parameter>x</parameter></paramdef>
|
|
<paramdef>int <parameter>y</parameter></paramdef>
|
|
<paramdef>int <parameter>border</parameter></paramdef>
|
|
<paramdef>int <parameter>col</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para> 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.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagefontheight">
|
|
<refnamediv>
|
|
<refname>ImageFontHeight</refname>
|
|
<refpurpose>get font height</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>imagefontheight</function></funcdef>
|
|
<paramdef>int <parameter>font</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
Returns the pixel height of a character in the specified font.
|
|
<para>
|
|
See also <function>imagefontwidth</function> and
|
|
<function>imageloadfont</function>.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagefontwidth">
|
|
<refnamediv>
|
|
<refname>ImageFontWidth</refname>
|
|
<refpurpose>get font width</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>imagefontwidth</function></funcdef>
|
|
<paramdef>int <parameter>font</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para> Returns the pixel width of a character in font.
|
|
<para> See also <function>imagefontheight</function> and <function>imageloadfont</function>.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagegif">
|
|
<refnamediv>
|
|
<refname>ImageGif</refname>
|
|
<refpurpose>output image to browser or file</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>imagegif</function></funcdef>
|
|
<paramdef>int <parameter>im</parameter></paramdef>
|
|
<paramdef>string <parameter>filename</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para> ImageGif creates the GIF file in filename from the image im. The im argument is the return from the
|
|
<function>imagecreate</function> function.
|
|
<para> The image format will be GIF87a unless the image has
|
|
been made transparent with <function>imagecolortransparent</function>, in
|
|
which case the image format will be GIF89a.
|
|
<para> 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 the
|
|
|
|
header
|
|
|
|
function, you can create a PHP script that outputs GIF images
|
|
directly.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imageinterlace">
|
|
<refnamediv>
|
|
<refname>ImageInterlace</refname>
|
|
<refpurpose>enable or disable interlace</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>imageinterlace</function></funcdef>
|
|
<paramdef>int <parameter>im</parameter></paramdef>
|
|
<paramdef>int <parameter><optional>interlace</optional></parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
<function>ImageInterlace</function> 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.
|
|
<para>
|
|
This functions returns whether the interlace bit is set for the image.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imageline">
|
|
<refnamediv>
|
|
<refname>ImageLine</refname>
|
|
<refpurpose>draw a line</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>imageline</function></funcdef>
|
|
<paramdef>int <parameter>im</parameter></paramdef>
|
|
<paramdef>int <parameter>x1</parameter></paramdef>
|
|
<paramdef>int <parameter>y1</parameter></paramdef>
|
|
<paramdef>int <parameter>x2</parameter></paramdef>
|
|
<paramdef>int <parameter>y2</parameter></paramdef>
|
|
<paramdef>int <parameter>col</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para> ImageLine draws a line from x1,y1 to
|
|
x2,y2 (top left is
|
|
0,0) in image im of color
|
|
col.
|
|
<para> See also <function>imagecreate</function> and <function>imagecolorallocate</function>.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imageloadfont">
|
|
<refnamediv>
|
|
<refname>ImageLoadFont</refname>
|
|
<refpurpose>load a new font</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>imageloadfont</function></funcdef>
|
|
<paramdef>string <parameter>file</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
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).
|
|
|
|
<para>
|
|
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.
|
|
|
|
<para>
|
|
<table>
|
|
<title>Font file format</title>
|
|
<tgroup cols="3">
|
|
<thead>
|
|
<row>
|
|
<entry>byte position</entry>
|
|
<entry>C data type</entry>
|
|
<entry>description</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>byte 0-3</entry>
|
|
<entry>int</entry>
|
|
<entry>number of characters in the font</entry>
|
|
</row>
|
|
<row>
|
|
<entry>byte 4-7</entry>
|
|
<entry>int</entry>
|
|
<entry>
|
|
value of first character in the font (often 32 for space)
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>byte 8-11</entry>
|
|
<entry>int</entry>
|
|
<entry>pixel width of each character</entry>
|
|
</row>
|
|
<row>
|
|
<entry>byte 12-15</entry>
|
|
<entry>int</entry>
|
|
<entry>pixel height of each character</entry>
|
|
</row>
|
|
<row>
|
|
<entry>byte 16-</entry>
|
|
<entry>char</entry>
|
|
<entry>
|
|
array with character data, one byte per pixel in each
|
|
character, for a total of (nchars*width*height) bytes.
|
|
</entry>
|
|
</row>
|
|
|
|
</tbody>
|
|
</tgroup>
|
|
</table>
|
|
|
|
<para>
|
|
See also <function>ImageFontWidth</function> and
|
|
<function>ImageFontHeight</function>.
|
|
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagepolygon">
|
|
<refnamediv>
|
|
<refname>ImagePolygon</refname>
|
|
<refpurpose>draw a polygon</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>imagepolygon</function></funcdef>
|
|
<paramdef>int <parameter>im</parameter></paramdef>
|
|
<paramdef>array <parameter>points</parameter></paramdef>
|
|
<paramdef>int <parameter>num_points</parameter></paramdef>
|
|
<paramdef>int <parameter>col</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para> 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.
|
|
<para> See also <function>imagecreate</function>.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagerectangle">
|
|
<refnamediv>
|
|
<refname>ImageRectangle</refname>
|
|
<refpurpose>draw a rectangle</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>imagerectangle</function></funcdef>
|
|
<paramdef>int <parameter>im</parameter></paramdef>
|
|
<paramdef>int <parameter>x1</parameter></paramdef>
|
|
<paramdef>int <parameter>y1</parameter></paramdef>
|
|
<paramdef>int <parameter>x2</parameter></paramdef>
|
|
<paramdef>int <parameter>y2</parameter></paramdef>
|
|
<paramdef>int <parameter>col</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para> 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.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagesetpixel">
|
|
<refnamediv>
|
|
<refname>ImageSetPixel</refname>
|
|
<refpurpose>set a single pixel</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>imagesetpixel</function></funcdef>
|
|
<paramdef>int <parameter>im</parameter></paramdef>
|
|
<paramdef>int <parameter>x</parameter></paramdef>
|
|
<paramdef>int <parameter>y</parameter></paramdef>
|
|
<paramdef>int <parameter>col</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para> ImageSetPixel draws a pixel at x,y
|
|
(top left is 0,0) in image im
|
|
of color col.
|
|
<para> See also <function>imagecreate</function> and <function>imagecolorallocate</function>.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagestring">
|
|
<refnamediv>
|
|
<refname>ImageString</refname>
|
|
<refpurpose>draw a string horizontally</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>imagestring</function></funcdef>
|
|
<paramdef>int <parameter>im</parameter></paramdef>
|
|
<paramdef>int <parameter>font</parameter></paramdef>
|
|
<paramdef>int <parameter>x</parameter></paramdef>
|
|
<paramdef>int <parameter>y</parameter></paramdef>
|
|
<paramdef>string <parameter>s</parameter></paramdef>
|
|
<paramdef>int <parameter>col</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para> 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.
|
|
<para> See also <function>imageloadfont</function>.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagestringup">
|
|
<refnamediv>
|
|
<refname>ImageStringUp</refname>
|
|
<refpurpose>draw a string vertically</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>imagestringup</function></funcdef>
|
|
<paramdef>int <parameter>im</parameter></paramdef>
|
|
<paramdef>int <parameter>font</parameter></paramdef>
|
|
<paramdef>int <parameter>x</parameter></paramdef>
|
|
<paramdef>int <parameter>y</parameter></paramdef>
|
|
<paramdef>string <parameter>s</parameter></paramdef>
|
|
<paramdef>int <parameter>col</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para> 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.
|
|
<para> See also <function>imageloadfont</function>.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagesx">
|
|
<refnamediv>
|
|
<refname>ImageSX</refname>
|
|
<refpurpose>get image width</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>imagesx</function></funcdef>
|
|
<paramdef>int <parameter>im</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para> ImageSX returns the width of the image identified by
|
|
im.
|
|
<para> See also <function>imagecreate</function> and <function>imagesy</function>.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagesy">
|
|
<refnamediv>
|
|
<refname>ImageSY</refname>
|
|
<refpurpose>get image height</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>imagesy</function></funcdef>
|
|
<paramdef>int <parameter>im</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
ImageSY returns the height of the image identified by im.
|
|
<para>See also <function>imagecreate</function> and
|
|
<function>imagesx</function>.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagettfbbox">
|
|
<refnamediv>
|
|
<refname>ImageTTFBBox</refname>
|
|
<refpurpose>give the bounding box of a text using TypeType fonts</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>array <function>ImageTTFBBox</function></funcdef>
|
|
<paramdef>int <parameter>size</parameter></paramdef>
|
|
<paramdef>int <parameter>angle</parameter></paramdef>
|
|
<paramdef>string <parameter>fontfile</parameter></paramdef>
|
|
<paramdef>string <parameter>text</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
This function calculates and returns the bounding box in pixels
|
|
a TrueType text.
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>text</parameter></term>
|
|
<listitem><simpara>The string to be measured.
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>size</parameter></term>
|
|
<listitem><simpara>The font size.
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>fontfile</parameter></term>
|
|
<listitem><simpara>The name of the TrueType font file. (Can
|
|
also be an URL.)
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>angle</parameter></term>
|
|
<listitem><simpara>Angle in degrees in which
|
|
<parameter>text</parameter> will be measured.
|
|
</varlistentry>
|
|
</variablelist>
|
|
|
|
<function>ImageTTFBBox</function> returns an array with 8
|
|
elements representing four points making the bounding box of the
|
|
text:
|
|
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<tbody>
|
|
<row>
|
|
<entry>0</entry>
|
|
<entry>lower left corner, X position</entry>
|
|
</row>
|
|
<row>
|
|
<entry>1</entry>
|
|
<entry>lower left corner, Y position</entry>
|
|
</row>
|
|
<row>
|
|
<entry>2</entry>
|
|
<entry>lower right corner, X position</entry>
|
|
</row>
|
|
<row>
|
|
<entry>3</entry>
|
|
<entry>lower right corner, Y position</entry>
|
|
</row>
|
|
<row>
|
|
<entry>4</entry>
|
|
<entry>upper right corner, X position</entry>
|
|
</row>
|
|
<row>
|
|
<entry>5</entry>
|
|
<entry>upper right corner, Y position</entry>
|
|
</row>
|
|
<row>
|
|
<entry>6</entry>
|
|
<entry>upper left corner, X position</entry>
|
|
</row>
|
|
<row>
|
|
<entry>7</entry>
|
|
<entry>upper left corner, Y position</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
The points are relative to the <emphasis>text</emphasis>
|
|
regardless of the angle, so "upper left" means in the top
|
|
left-hand corner seeing the text horizontallty.
|
|
<para>
|
|
This function requires both the GD library and the Freetype library.
|
|
<para>
|
|
See also <function>ImageTTFText</function>.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagettftext">
|
|
<refnamediv>
|
|
<refname>ImageTTFText</refname>
|
|
<refpurpose>write text to the image using a TrueType fonts</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>array <function>ImageTTFText</function></funcdef>
|
|
<paramdef>int <parameter>im</parameter></paramdef>
|
|
<paramdef>int <parameter>size</parameter></paramdef>
|
|
<paramdef>int <parameter>angle</parameter></paramdef>
|
|
<paramdef>int <parameter>x</parameter></paramdef>
|
|
<paramdef>int <parameter>y</parameter></paramdef>
|
|
<paramdef>int <parameter>col</parameter></paramdef>
|
|
<paramdef>string <parameter>fontfile</parameter></paramdef>
|
|
<paramdef>string <parameter>text</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
ImageTTFText draws the string <parameter>text</parameter> in the
|
|
image identified by <parameter>im</parameter>, starting at
|
|
coordinates <parameter>x,y</parameter> (top left is 0,0), at an
|
|
angle of <parameter>angle</parameter> in color
|
|
<parameter>col</parameter>, using the TrueType font file
|
|
identified by <parameter>fontfile</parameter>.
|
|
<para>
|
|
The coordinates given by
|
|
<parameter>x</parameter>,<parameter>y</parameter> will define the
|
|
basepoint of the first character (roughly the lower-left corner
|
|
of the character). This is different from the
|
|
<function>ImageString</function>, where x,y define the
|
|
upper-right corner of the first character.
|
|
<para>
|
|
<parameter>angle</parameter> 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).
|
|
<para>
|
|
<parameter>fontfile</parameter> is the path to the TrueType font
|
|
you wish to use.
|
|
<para>
|
|
<parameter>text</parameter> 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.
|
|
<para>
|
|
<parameter>col</parameter> is the color index. Using the negative
|
|
of a color index has the effect of turning off antialiasing.
|
|
<para>
|
|
<function>ImageTTFText</function> 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.
|
|
<para>
|
|
This example script will produce a black GIF 400x30 pixels, with
|
|
the words "Testing..." in white in the font Arial.
|
|
<example>
|
|
<title>ImageTTFText</title>
|
|
<programlisting>
|
|
<?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);
|
|
?>
|
|
</programlisting></example>
|
|
|
|
<para>
|
|
This function requires both the GD library and the <ulink
|
|
url="&url.freetype;">FreeType</ulink> library.
|
|
<para>
|
|
See also <function>ImageTTFBBox</function>.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagecolorat">
|
|
<refnamediv>
|
|
<refname>ImageColorAt</refname>
|
|
<refpurpose>get the index of the color of a pixel</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>imagecolorat</function></funcdef>
|
|
<paramdef>int <parameter>im</parameter></paramdef>
|
|
<paramdef>int <parameter>x</parameter></paramdef>
|
|
<paramdef>int <parameter>y</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
Returns the index of the color of the pixel at the
|
|
specified location in the image.
|
|
<para>
|
|
See also <function>imagecolorset</function> and
|
|
<function>imagecolorsforindex</function>.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagecolorclosest">
|
|
<refnamediv>
|
|
<refname>ImageColorClosest</refname>
|
|
<refpurpose>get the index of the closest color to the specified color</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>imagecolorclosest</function></funcdef>
|
|
<paramdef>int <parameter>im</parameter></paramdef>
|
|
<paramdef>int <parameter>red</parameter></paramdef>
|
|
<paramdef>int <parameter>green</parameter></paramdef>
|
|
<paramdef>int <parameter>blue</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
Returns the index of the color in the palette of the image
|
|
which is "closest" to the specified RGB value.
|
|
<para>
|
|
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.
|
|
<para>
|
|
See also <function>imagecolorexact</function>.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagecolorexact">
|
|
<refnamediv>
|
|
<refname>ImageColorExact</refname>
|
|
<refpurpose>get the index of the specified color</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>imagecolorexact</function></funcdef>
|
|
<paramdef>int <parameter>im</parameter></paramdef>
|
|
<paramdef>int <parameter>red</parameter></paramdef>
|
|
<paramdef>int <parameter>green</parameter></paramdef>
|
|
<paramdef>int <parameter>blue</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
Returns the index of the specified color in the palette of the image.
|
|
<para>
|
|
If the color does not exist in the image's palette, -1 is returned.
|
|
<para>
|
|
See also <function>imagecolorclosest</function>.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagecolorresolve">
|
|
<refnamediv>
|
|
<refname>ImageColorResolve</refname>
|
|
<refpurpose>get the index of the specified color or its closest possible alternative</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>imagecolorresolve</function></funcdef>
|
|
<paramdef>int <parameter>im</parameter></paramdef>
|
|
<paramdef>int <parameter>red</parameter></paramdef>
|
|
<paramdef>int <parameter>green</parameter></paramdef>
|
|
<paramdef>int <parameter>blue</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
This function is guaranteed to return a color index for a requested color, either the exact color
|
|
or the closest possible alternative.
|
|
<para>
|
|
See also <function>imagecolorclosest</function>.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagecolorset">
|
|
<refnamediv>
|
|
<refname>ImageColorSet</refname>
|
|
<refpurpose>set the color for the specified palette index</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>bool <function>imagecolorset</function></funcdef>
|
|
<paramdef>int <parameter>im</parameter></paramdef>
|
|
<paramdef>int <parameter>index</parameter></paramdef>
|
|
<paramdef>int <parameter>red</parameter></paramdef>
|
|
<paramdef>int <parameter>green</parameter></paramdef>
|
|
<paramdef>int <parameter>blue</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
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.
|
|
<para>
|
|
See also <function>imagecolorat</function>.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagecolorsforindex">
|
|
<refnamediv>
|
|
<refname>ImageColorsForIndex</refname>
|
|
<refpurpose>get the colors for an index</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>array <function>imagecolorsforindex</function></funcdef>
|
|
<paramdef>int <parameter>im</parameter></paramdef>
|
|
<paramdef>int <parameter>index</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
This returns an associative array with red, green, and blue keys
|
|
that contain the appropriate values for the specified color index.
|
|
<para>
|
|
See also <function>imagecolorat</function> and
|
|
<function>imagecolorexact</function>.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagecolorstotal">
|
|
<refnamediv>
|
|
<refname>ImageColorsTotal</refname>
|
|
<refpurpose>find out the number of colors in an image's palette</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>imagecolorstotal</function></funcdef>
|
|
<paramdef>int <parameter>im</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
This returns the number of colors in the specified image's palette.
|
|
<para>
|
|
See also <function>imagecolorat</function> and
|
|
<function>imagecolorsforindex</function>.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagepsloadfont">
|
|
<refnamediv>
|
|
<refname>ImagePSLoadFont</refname>
|
|
<refpurpose>load a PostScript Type 1 from file</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>imagepsloadfont</function></funcdef>
|
|
<paramdef>string <parameter>filename</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
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.
|
|
<para>
|
|
See also <function>imagepsfreefont</function>.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagepsfreefont">
|
|
<refnamediv>
|
|
<refname>ImagePSFreeFont</refname>
|
|
<refpurpose>free memory used by a PostScript Type 1 font</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>void <function>imagepsfreefont</function></funcdef>
|
|
<paramdef>int <parameter>fontindex</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
See also <function>imagepsloadfont</function>.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<!-- The function in t1lib which this function uses seems to be buggy...
|
|
Currently, just comment out everywhere in the docs and source until time
|
|
permits to find a solution.
|
|
|
|
<refentry id="function.imagepscopyfont">
|
|
<refnamediv>
|
|
<refname>ImagePSCopyFont</refname>
|
|
<refpurpose>make a copy of an already loaded font for further modification</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>imagepscopyfont</function></funcdef>
|
|
<paramdef>int <parameter>fontindex</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
Use this function if you need make further modifications to the 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 <function>imagepsloadfont</function>,
|
|
not a font that is itself a copied one. You can although make modifications to it before copying,
|
|
<para>
|
|
If you use this function, you <emphasis>must</emphasis> free the fonts obtained this
|
|
way yourself and in reverse order. Otherwise your script <emphasis>will</emphasis> hang.
|
|
<para>
|
|
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.
|
|
<para>
|
|
See also <function>imageploadpsfont</function>.
|
|
</refsect1>
|
|
</refentry>
|
|
-->
|
|
|
|
<refentry id="function.imagepsencodefont">
|
|
<refnamediv>
|
|
<refname>ImagePSEncodeFont</refname>
|
|
<refpurpose>change the character encoding vector of a font</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>imagepsencodefont</function></funcdef>
|
|
<paramdef>string <parameter>encodingfile</parameter></paramdef>
|
|
</funcsynopsis>
|
|
|
|
<para>
|
|
Loads a character encoding vector from from a file and changes the fonts
|
|
encoding vector to it. As a PostScript fonts default vector lacks most of the
|
|
character positions above 127, you'll 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.
|
|
<para>
|
|
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 php3.ini to point to the right
|
|
encoding file and all fonts you load will automatically have the right encoding.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagepstext">
|
|
<refnamediv>
|
|
<refname>ImagePSText</refname>
|
|
<refpurpose>to draw a text string over an image using PostScript Type1 fonts</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Descriptiom</title>
|
|
<funcsynopsis>
|
|
<funcdef>array <function>imagepstext</function></funcdef>
|
|
<paramdef>int <parameter>image</parameter></paramdef>
|
|
<paramdef>string <parameter>text</parameter></paramdef>
|
|
<paramdef>int <parameter>font</parameter></paramdef>
|
|
<paramdef>int <parameter>size</parameter></paramdef>
|
|
<paramdef>int <parameter>foreground</parameter></paramdef>
|
|
<paramdef>int <parameter>background</parameter></paramdef>
|
|
<paramdef>int <parameter>x</parameter></paramdef>
|
|
<paramdef>int <parameter>y</parameter></paramdef>
|
|
<paramdef>int <parameter>space</parameter></paramdef>
|
|
<paramdef>int <parameter>tightness</parameter></paramdef>
|
|
<paramdef>float <parameter>angle</parameter></paramdef>
|
|
<paramdef>int <parameter>antialias_steps</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
<parameter>size</parameter> is expressed in pixels.
|
|
<para>
|
|
<parameter>foreground</parameter> is the color in which the text will be painted.
|
|
<parameter>background</parameter> is the color to which the text will try to fade in
|
|
with antialiasing. No pixels with the color <parameter>background</parameter> are
|
|
actually painted, so the background image does not need to be of solid color.
|
|
<para>
|
|
The coordinates given by <parameter>x</parameter>, <parameter>y</parameter>
|
|
will define the origin (or reference point) of the first character
|
|
(roughly the lower-left corner of the character). This is different from the
|
|
<function>ImageString</function>, 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.
|
|
<para>
|
|
<parameter>space</parameter> 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.
|
|
<para>
|
|
<parameter>tightness</parameter> 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.
|
|
<para>
|
|
<parameter>angle</parameter> is in degrees.
|
|
<para>
|
|
<parameter>antialias_steps</parameter> 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.
|
|
<para>
|
|
Parameters <parameter>space</parameter> and <parameter>tightness</parameter>
|
|
are expressed in character space units, where 1 unit is 1/1000th of an em-square.
|
|
<para>
|
|
Parameters <parameter>space</parameter>, <parameter>tightness</parameter>,
|
|
<parameter>angle</parameter> and <parameter>antialias</parameter> are optional.
|
|
<para>
|
|
This function returns an array containing the following elements:
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<tbody>
|
|
<row>
|
|
<entry>0</entry>
|
|
<entry>lower left x-coordinate</entry>
|
|
</row>
|
|
<row>
|
|
<entry>1</entry>
|
|
<entry>lower left y-coordinate</entry>
|
|
</row>
|
|
<row>
|
|
<entry>2</entry>
|
|
<entry>upper right x-coordinate</entry>
|
|
</row>
|
|
<row>
|
|
<entry>3</entry>
|
|
<entry>upper right y-coordinate</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
<para>
|
|
See also <function>imagepsbbox</function>.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagepsbbox">
|
|
<refnamediv>
|
|
<refname>ImagePSBBox</refname>
|
|
<refpurpose>give the bounding box of a text rectangle using PostScript Type1 fonts</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>array <function>imagepsbbox</function></funcdef>
|
|
<paramdef>string <parameter>text</parameter></paramdef>
|
|
<paramdef>int <parameter>font</parameter></paramdef>
|
|
<paramdef>int <parameter>size</parameter></paramdef>
|
|
<paramdef>int <parameter>space</parameter></paramdef>
|
|
<paramdef>int <parameter>width</parameter></paramdef>
|
|
<paramdef>float <parameter>angle</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
<parameter>size</parameter> is expressed in pixels.
|
|
<para>
|
|
<parameter>space</parameter> 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.
|
|
<para>
|
|
<parameter>tightness</parameter> 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.
|
|
<para>
|
|
<parameter>angle</parameter> is in degrees.
|
|
<para>
|
|
Parameters <parameter>space</parameter> and <parameter>tightness</parameter>
|
|
are expressed in character space units, where 1 unit is 1/1000th of an em-square.
|
|
<para>
|
|
Parameters <parameter>space</parameter>, <parameter>tightness</parameter> and
|
|
<parameter>angle</parameter> are optional.
|
|
<para>
|
|
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.
|
|
<para>
|
|
This function returns an array containing the following elements:
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<tbody>
|
|
<row>
|
|
<entry>0</entry>
|
|
<entry>lower left x-coordinate</entry>
|
|
</row>
|
|
<row>
|
|
<entry>1</entry>
|
|
<entry>lower left y-coordinate</entry>
|
|
</row>
|
|
<row>
|
|
<entry>2</entry>
|
|
<entry>upper right x-coordinate</entry>
|
|
</row>
|
|
<row>
|
|
<entry>3</entry>
|
|
<entry>upper right y-coordinate</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
<para>
|
|
See also <function>imagepstext</function>.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
</reference>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"../manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
-->
|