mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-29 07:18:55 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@111754 c90b9560-bf6c-de11-be94-00142212c4b1
3498 lines
129 KiB
XML
3498 lines
129 KiB
XML
<!-- D O N O T E D I T T H I S F I L E ! ! !
|
|
|
|
it is still here for historical reasons only
|
|
(as translators may need to check old revision diffs)
|
|
|
|
if you want to change things documented in this file
|
|
you should now edit the files found under en/reference
|
|
instead -->
|
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.96 $ -->
|
|
<reference id="ref.image">
|
|
<title>Image functions</title>
|
|
<titleabbrev>Image</titleabbrev>
|
|
|
|
<partintro>
|
|
<simpara>
|
|
You can use the image functions in PHP to get the size of
|
|
<acronym>JPEG</acronym>, <acronym>GIF</acronym>,
|
|
<acronym>PNG</acronym>, <acronym>SWF</acronym>,
|
|
<acronym>TIFF</acronym> and <acronym>JPEG2000</acronym> images, and if
|
|
you have the <acronym>GD</acronym> library (available at <ulink
|
|
url="&url.gd;">&url.gd;</ulink>) you will also be able to create
|
|
and manipulate images.
|
|
</simpara>
|
|
<simpara>
|
|
If you have PHP compiled with <option role="configure">--enable-exif</option>
|
|
you are able to work with information stored in headers of
|
|
<acronym>JPEG</acronym> and <acronym>TIFF</acronym> images. These
|
|
functions do not require <acronym>GD</acronym> library.
|
|
</simpara>
|
|
<simpara>
|
|
The format of images you are able to manipulate depend on the
|
|
version of gd you install, and any other libraries gd might need
|
|
to access those image formats. Versions of gd older than gd-1.6
|
|
support gif format images, and do not support png, where versions
|
|
greater than gd-1.6 support png, not gif.
|
|
</simpara>
|
|
<simpara>
|
|
In order to read and write images in jpeg format, you will need to
|
|
obtain and install jpeg-6b (available at
|
|
<ulink url="&url.jpeg;">&url.jpeg;</ulink>), and then recompile gd to
|
|
make use of jpeg-6b. You will also have to compile PHP with
|
|
<option role="configure">--with-jpeg-dir=/path/to/jpeg-6b</option>.
|
|
</simpara>
|
|
<simpara>
|
|
To add support for Type 1 fonts, you can install t1lib (available
|
|
at <ulink url="&url.t1lib;">&url.t1lib;</ulink>), and then add
|
|
<option role="configure">--with-t1lib[=dir]</option>.
|
|
</simpara>
|
|
</partintro>
|
|
|
|
<refentry id="function.exif-imagetype">
|
|
<refnamediv>
|
|
<refname>exif_imagetype</refname>
|
|
<refpurpose>Determine the type of an image</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int|false</type><methodname>exif_imagetype</methodname>
|
|
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>exif_imagetype</function> reads the first bytes of an image and
|
|
checks its signature. When a correct signature is found a constant will be
|
|
returned otherwise the return value is &false;. The return value is the same
|
|
value that <function>getimagesize</function> returns in index 2 but this
|
|
function is much faster.
|
|
</para>
|
|
<para>
|
|
The following constants are defined:
|
|
1 = IMAGETYPE_GIF, 2 = IMAGETYPE_JPEG, 3 = IMAGETYPE_PNG, 4 = IMAGETYPE_SWF,
|
|
5 = IMAGETYPE_PSD, 6 = IMAGETYPE_BMP, 7 = IMAGETYPE_TIFF_II (intel byte order),
|
|
8 = IMAGETYPE_TIFF_MM (motorola byte order), 9 = IMAGETYPE_JPC, 10 = IMAGETYPE_JP2,
|
|
11 = IMAGETYPE_JPX.
|
|
</para>
|
|
<para>
|
|
This function can be used to avoid calls to other exif functions with unsupported
|
|
file teypes or in conjunction with $_SERVER['HTTP_ACCEPT'] to check whether or
|
|
not the viewer is able to see a specific image in his browser.
|
|
</para>
|
|
<para>
|
|
<note>
|
|
<simpara>
|
|
This function is only available in PHP 4 compiled using
|
|
<option role="configure">--enable-exif</option>.
|
|
</simpara>
|
|
<simpara>
|
|
This function does not require the GD image library.
|
|
</simpara>
|
|
<simpara>
|
|
See also <function>getimagesize</function>.
|
|
</simpara>
|
|
</note>
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.exif-read-data">
|
|
<refnamediv>
|
|
<refname>exif_read_data</refname>
|
|
<refpurpose>Read the <acronym>EXIF</acronym> headers from <acronym>JPEG</acronym>
|
|
or <acronym>TIFF</acronym></refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>exif_read_data</methodname>
|
|
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
|
|
<methodparam choice="opt"><type>string</type><parameter>sections</parameter></methodparam>
|
|
<methodparam choice="opt"><type>bool</type><parameter>arrays</parameter></methodparam>
|
|
<methodparam choice="opt"><type>bool</type><parameter>thumbnail</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
The <function>exif_read_data</function> function reads the
|
|
EXIF headers from a JPEG or TIFF image file. It returns an associative
|
|
array where the indexes are the header names and the values
|
|
are the values associated with those headers. If no data can be returned
|
|
the result is &false;.
|
|
</para>
|
|
<para>
|
|
<parameter>filename</parameter> is the name of the file to read. This
|
|
cannot be a url.
|
|
</para>
|
|
<para>
|
|
<parameter>sections</parameter> a comma separated lsit of sections that
|
|
need to be present in file to produce a result array.
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<tbody>
|
|
<row>
|
|
<entry>FILE</entry>
|
|
<entry>FileName, FileSize, FileDateTime, SectionsFound</entry>
|
|
</row>
|
|
<row>
|
|
<entry>COMPUTED</entry>
|
|
<entry>html, Width, Height, IsColor and some more if available.
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>ANY_TAG</entry>
|
|
<entry>Any information that has a Tag e.g. IFD0, EXIF, ...</entry>
|
|
</row>
|
|
<row>
|
|
<entry>IFD0</entry>
|
|
<entry>All tagged data of IFD0. In normal imagefiles this contains
|
|
image size and so forth.</entry>
|
|
</row>
|
|
<row>
|
|
<entry>THUMBNAIL</entry>
|
|
<entry>A file is supposed to contain a thumbnail if it has a second IFD.
|
|
All tagged information about the embedded thumbnail is stored in this
|
|
section.</entry>
|
|
</row>
|
|
<row>
|
|
<entry>COMMENT</entry>
|
|
<entry>Comment headers of JPEG images.</entry>
|
|
</row>
|
|
<row>
|
|
<entry>EXIF</entry>
|
|
<entry>The EXIF section is a sub section of IFD0. It contains
|
|
more detailed information about an image. Most of these entries
|
|
are digital camera related.</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</para>
|
|
<para>
|
|
<parameter>arrays</parameter> specifies whether or not each section
|
|
becomes an array. The sections <emphasis>FILE</emphasis>,
|
|
<emphasis>COMPUTED</emphasis> and <emphasis>THUMBNAIL</emphasis> allways
|
|
become arrays as they may contain values whose names are conflict
|
|
with other sections.
|
|
</para>
|
|
<para>
|
|
<parameter>thumbnail</parameter> whether or not to read the thumbnail
|
|
itself and not only its tagged data.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
Exif headers tend to be present in JPEG/TIFF images generated by digital
|
|
cameras, but unfortunately each digital camera maker has a different
|
|
idea of how to actually tag their images, so you can't always rely on
|
|
a specific Exif header being present.
|
|
</para>
|
|
</note>
|
|
<para>
|
|
<example>
|
|
<title><function>exif_read_data</function> example</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
echo "test1.jpg:<br>\n";
|
|
$exif = exif_read_data ('tests/test1.jpg','IFD0');
|
|
echo $exif===false ? "No header data found.<br>\n" : "Image contains headers<br>";
|
|
$exif = exif_read_data ('tests/test2.jpg',0,true);
|
|
echo "test2.jpg:<br>\n";
|
|
foreach($exif as $key=>$section) {
|
|
foreach($section as $name=>$val) {
|
|
echo "$key.$name: $val<br>\n";
|
|
}
|
|
}?>
|
|
]]>
|
|
</programlisting>
|
|
<para>
|
|
The first call fails because the image has no header information.
|
|
<screen role="php">
|
|
<![CDATA[
|
|
test1.jpg:
|
|
No header data found.
|
|
test2.jpg:
|
|
FILE.FileName: test2.jpg
|
|
FILE.FileDateTime: 1017666176
|
|
FILE.FileSize: 1240
|
|
FILE.FileType: 2
|
|
FILE.SectionsFound: ANY_TAG, IFD0, THUMBNAIL, COMMENT
|
|
COMPUTED.html: width="1" height="1"
|
|
COMPUTED.Height: 1
|
|
COMPUTED.Width: 1
|
|
COMPUTED.IsColor: 1
|
|
COMPUTED.ByteOrderMotorola: 1
|
|
COMPUTED.UserComment: Exif test image.
|
|
COMPUTED.UserCommentEncoding: ASCII
|
|
COMPUTED.Copyright: Photo (c) M.Boerger, Edited by M.Boerger.
|
|
COMPUTED.Copyright.Photographer: Photo (c) M.Boerger
|
|
COMPUTED.Copyright.Editor: Edited by M.Boerger.
|
|
IFD0.Copyright: Photo (c) M.Boerger
|
|
IFD0.UserComment: ASCII
|
|
THUMBNAIL.JPEGInterchangeFormat: 134
|
|
THUMBNAIL.JPEGInterchangeFormatLength: 523
|
|
COMMENT.0: Comment #1.
|
|
COMMENT.1: Comment #2.
|
|
COMMENT.2: Comment #3end
|
|
]]>
|
|
<!-- Version 4.3 will provide additional lines
|
|
THUMBNAIL.JPEGInterchangeFormat: 134
|
|
THUMBNAIL.Thumbnail.Height: 1
|
|
THUMBNAIL.Thumbnail.Height: 1
|
|
-->
|
|
</screen>
|
|
</para>
|
|
</example>
|
|
</para>
|
|
<note>
|
|
<para>
|
|
If the image contains any IFD0 data then COMPUTED contains the entry
|
|
ByteOrderMotorola which is 0 for little-endian (intel) and 1 for
|
|
big-endian (motorola) byte order. This was added in PHP 4.3.
|
|
</para>
|
|
<para>
|
|
When an Exif header contains a Copyright note this itself can contain two
|
|
values. As the solution is inconsitent in the Exif 2.10 standard the COMPUTED
|
|
section will return both entries <emphasis>Copyright.Photographer</emphasis>
|
|
and <emphasis>Copyright.Editor</emphasis> while the IFD0 sections contains
|
|
the byte array with the NULL character that splits both entries. Or just the
|
|
first entry if the datatype was wrong (normal behaviour of Exif). The
|
|
COMPUTED will contain also an entry <emphasis>Copyright</emphasis> Which
|
|
is either the original copyright string or it is a comma separated list of
|
|
photo and editor copyright.
|
|
</para>
|
|
</note>
|
|
<note>
|
|
<para>
|
|
The tag UserComment has the same problem as the Copyright tag. It can store
|
|
two values first the encoding used and second the value itself. If so the
|
|
IFD section only contains the encoding or a byte array. The COMPUTED section
|
|
will store both in the entries <emphasis>UserCommentEncoding</emphasis> and
|
|
<emphasis>UserComment</emphasis>. The entry <emphasis>UserComment</emphasis>
|
|
is available in both cases so it should be used in preference to the value
|
|
in IFD0 section.
|
|
</para>
|
|
<para>
|
|
If the user comment uses Unicode or JIS encoding and the module mbstring is
|
|
available this encoding will automatically changed according to the exif
|
|
ini settings. This was added in PHP 4.3.
|
|
</para>
|
|
</note>
|
|
<note>
|
|
<para>
|
|
Height and Width are computed the same way <function>getimagesize</function>
|
|
does so their values must not be part of any header returned. Also html is
|
|
a height/width text string to be used inside normal <acronym>HTML</acronym>.
|
|
</para>
|
|
</note>
|
|
<note>
|
|
<para>
|
|
Starting from PHP 4.3 the function can read all embedded <acronym>IFD</acronym>
|
|
data including arrays (returned as such). Also the size of an embedded thumbnail
|
|
is returned in <emphasis>THUMBNAIL</emphasis> subarray and the function
|
|
<function>exif_read_data</function> can return thumbnails in <acronym>TIFF</acronym>
|
|
format. Last but not least there is no longer a maximum legth for returned
|
|
values (not until memory limit is reached).
|
|
</para>
|
|
</note>
|
|
<note>
|
|
<simpara>
|
|
This function is only available in PHP 4 compiled using
|
|
<option role="configure">--enable-exif</option>.
|
|
Its functionality and behaviour has changed in PHP 4.2. Earlier versions
|
|
are very unstable.
|
|
</simpara>
|
|
<simpara>
|
|
Since PHP 4.3 user comment can automatically change encoding if PHP 4 was
|
|
compiled using <option role="configure">--enable-mbstring</option>.
|
|
</simpara>
|
|
<simpara>
|
|
This function does not require the GD image library.
|
|
</simpara>
|
|
<simpara>
|
|
See also <function>exif_thumbnail</function> and <function>getimagesize</function>.
|
|
</simpara>
|
|
</note>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.exif-thumbnail">
|
|
<refnamediv>
|
|
<refname>exif_thumbnail</refname>
|
|
<refpurpose>Retrieve the embedded thumbnail of a TIFF or JPEG image</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>exif_thumbnail</methodname>
|
|
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>&width</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>&height</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>exif_thumbnail</function> reads the embedded thumbnail of
|
|
a TIFF or JPEG image. If the image contains no thumbnail &false;
|
|
will be returned.
|
|
</para>
|
|
<para>
|
|
Both parameters <parameter>width</parameter> and <parameter>height</parameter> are
|
|
available since PHP 4.3 and return the size of the thumbnail. It is possible that
|
|
<function>exif_thumbnail</function> cannot create an image but determine its
|
|
size. In this case the return value is &false; but <parameter>width</parameter> and
|
|
<parameter>height</parameter> are set.
|
|
</para>
|
|
<para>
|
|
Starting from version PHP 4.3 the function <function>exif_thumbnail</function> can
|
|
return thumbnails in <acronym>TIFF</acronym> format.
|
|
</para>
|
|
<para>
|
|
<note>
|
|
<simpara>
|
|
This function is only available in PHP 4 compiled using
|
|
<option role="configure">--enable-exif</option>.
|
|
Its functionality and behaviour has changed in PHP 4.2
|
|
</simpara>
|
|
<simpara>
|
|
This function does not require the GD image library.
|
|
</simpara>
|
|
<simpara>
|
|
See also <function>exif_read_data</function>.
|
|
</simpara>
|
|
</note>
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.getimagesize">
|
|
<refnamediv>
|
|
<refname>getimagesize</refname>
|
|
<refpurpose>Get the size of an image</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>getimagesize</methodname>
|
|
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
|
|
<methodparam choice="opt"><type>array</type><parameter>imageinfo</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
The <function>getimagesize</function> function will determine the
|
|
size of any <acronym>GIF</acronym>, <acronym>JPG</acronym>,
|
|
<acronym>PNG</acronym>, <acronym>SWF</acronym>,
|
|
<acronym>PSD</acronym>, <acronym>TIFF</acronym>
|
|
or <acronym>BMP</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>
|
|
<literal>IMG</literal> tag.
|
|
</para>
|
|
<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, 4 = SWF, 5 = PSD, 6 = BMP, 7 = TIFF(intel byte order),
|
|
8 = TIFF(motorola byte order, 9 = JPC, 10 = JP2, 11 = JPX.
|
|
Index 3 is a text string with the correct
|
|
height="yyy" width="xxx" string that can be used directly in an IMG
|
|
tag.
|
|
<example>
|
|
<title>getimagesize (file)</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$size = getimagesize ("img/flag.jpg");
|
|
echo "<img src=\"img/flag.jpg\" {$size[3]}>";
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title>getimagesize (URL)</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php $size = getimagesize ("http://www.example.com/gifs/logo.gif"); ?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
With <acronym>JPG</acronym> images, two extras index are returned :
|
|
<literal>channel</literal> and <literal>bits</literal>.
|
|
<literal>channel</literal> will be 3 for RGB pictures, and 4 for CMYK
|
|
pictures. <literal>bits</literal> is the number of bits for each color.
|
|
</para>
|
|
<para>
|
|
If accessing the <parameter>filename</parameter> image is impossible,
|
|
or if it isn't a valid picture, <function>getimagesize</function>
|
|
will return &null; and generate a warning.
|
|
</para>
|
|
<para>
|
|
The optional <parameter>imageinfo</parameter> parameter allows
|
|
you to extract some extended information from the image
|
|
file. Currently this will return the different
|
|
<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 <acronym>IPTC</acronym>
|
|
<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>
|
|
<![CDATA[
|
|
<?php
|
|
$size = getimagesize ("testimg.jpg",&$info);
|
|
if (isset ($info["APP13"])) {
|
|
$iptc = iptcparse ($info["APP13"]);
|
|
var_dump ($iptc);
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
<note>
|
|
<simpara>
|
|
TIFF support was added in PHP 4.2. JPEG2000 support will be added
|
|
in PHP 4.3.
|
|
</simpara>
|
|
<simpara>
|
|
This function does not require the GD image library.
|
|
</simpara>
|
|
<simpara>
|
|
See also <function>exif_imagetype</function>, <function>exif_read_data</function>
|
|
and <function>exif_thumbnail</function>.
|
|
</simpara>
|
|
<simpara>
|
|
URL support was added in PHP 4.0.5
|
|
</simpara>
|
|
</note>
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.image2wbmp">
|
|
<refnamediv>
|
|
<refname>image2wbmp</refname>
|
|
<refpurpose>Output image to browser or file</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>image2wbmp</methodname>
|
|
<methodparam><type>int</type><parameter>im</parameter></methodparam>
|
|
<methodparam choice="opt"><type>string</type><parameter>filename</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>threshold</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>image2wbmp</function> creates the
|
|
<acronym>WBMP</acronym> file in filename from the image
|
|
<parameter>im</parameter>. The <parameter>im</parameter> argument
|
|
is the return from <function>imagecreate</function>.
|
|
</para>
|
|
<para>
|
|
The filename argument is optional, and if left off, the raw image
|
|
stream will be output directly.
|
|
By sending an <acronym>image/vnd.wap.wbmp</acronym> content-type
|
|
using <function>header</function>, you can create
|
|
a PHP script that outputs WBMP images directly.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
WBMP support is only available if PHP was compiled
|
|
against GD-1.8 or later.
|
|
</para>
|
|
</note>
|
|
<para>
|
|
See also <function>imagewbmp</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagealphablending">
|
|
<refnamediv>
|
|
<refname>imagealphablending</refname>
|
|
<refpurpose>Set the blending mode for an image</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagealphablending</methodname>
|
|
<methodparam><type>resource</type><parameter>im</parameter></methodparam>
|
|
<methodparam><type>bool</type><parameter>blendmode</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagealphablending</function> allows for two different
|
|
modes of drawing on truecolor images. In blending mode, the
|
|
alpha channel component of the color supplied to all drawing function,
|
|
such as <function>imagesetpixel</function> determines how much of the
|
|
underlying color should be allowed to shine through. As a result, gd
|
|
automatically blends the existing color at that point with the drawing color,
|
|
and stores the result in the image. The resulting pixel is opaque. In
|
|
non-blending mode, the drawing color is copied literally with its alpha channel
|
|
information, replacing the destination pixel. Blending mode is not available
|
|
when drawing on palette images.
|
|
If <parameter>blendmode</parameter> is &true;, then blending mode is enabled, otherwise
|
|
disabled.
|
|
</para>
|
|
<note><para>This function was added in PHP 4.0.6 and requires GD 2.0.1</para></note>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
|
|
<refentry id="function.imagearc">
|
|
<refnamediv>
|
|
<refname>imagearc</refname>
|
|
<refpurpose>Draw a partial ellipse</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagearc</methodname>
|
|
<methodparam><type>int</type><parameter>im</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>cx</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>cy</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>w</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>h</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>s</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>e</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>col</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagearc</function> draws a partial ellipse centered at
|
|
<parameter>cx</parameter>, <parameter>cy</parameter> (top left is
|
|
0, 0) in the image represented by <parameter>im</parameter>.
|
|
<parameter>W</parameter>
|
|
and <parameter>h</parameter> specifies the ellipse's width and
|
|
height respectively while the start and end points are specified
|
|
in degrees indicated by the <parameter>s</parameter> and
|
|
<parameter>e</parameter> arguments. 0° is located at the three-o'clock
|
|
position, and the arc is drawn counter-clockwise.
|
|
</para>
|
|
<para>
|
|
See also <function>imageellipse</function>,
|
|
<function>imagefilledellipse</function>, and
|
|
<function>imagefilledarc</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagefilledarc">
|
|
<refnamediv>
|
|
<refname>imagefilledarc</refname>
|
|
<refpurpose>Draw a partial ellipse and fill it</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagefilledarc</methodname>
|
|
<methodparam><type>int</type><parameter>im</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>cx</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>cy</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>w</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>h</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>s</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>e</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>col</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>style</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagefilledarc</function> draws a partial ellipse centered at
|
|
<parameter>cx</parameter>, <parameter>cy</parameter> (top left is
|
|
0, 0) in the image represented by <parameter>im</parameter>.
|
|
<parameter>W</parameter>
|
|
and <parameter>h</parameter> specifies the ellipse's width and
|
|
height respectively while the start and end points are specified
|
|
in degrees indicated by the <parameter>s</parameter> and
|
|
<parameter>e</parameter> arguments.
|
|
<parameter>style</parameter> is a bitwise OR of the following possibilities:
|
|
<orderedlist>
|
|
<listitem><simpara><literal>IMG_ARC_PIE</literal></simpara></listitem>
|
|
<listitem><simpara><literal>IMG_ARC_CHORD</literal></simpara></listitem>
|
|
<listitem><simpara><literal>IMG_ARC_NOFILL</literal></simpara></listitem>
|
|
<listitem><simpara><literal>IMG_ARC_EDGED</literal></simpara></listitem>
|
|
</orderedlist>
|
|
<literal>IMG_ARC_PIE</literal> and <literal>IMG_ARC_CHORD</literal> are
|
|
mutually exclusive; <literal>IMG_ARC_CHORD</literal> just
|
|
connects the starting and ending angles with a straight line, while
|
|
<literal>IMG_ARC_PIE</literal> produces a rounded edge.
|
|
<literal>IMG_ARC_NOFILL</literal> indicates that the arc
|
|
or chord should be outlined, not filled. <literal>IMG_ARC_EDGED</literal>,
|
|
used together with <literal>IMG_ARC_NOFILL</literal>, indicates that the
|
|
beginning and ending angles should be connected to the center - this is a
|
|
good way to outline (rather than fill) a 'pie slice'.
|
|
</para>
|
|
<note><para>This function was added in PHP 4.0.6 and requires GD 2.0.1</para></note>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
|
|
|
|
<refentry id="function.imageellipse">
|
|
<refnamediv>
|
|
<refname>imageellipse</refname>
|
|
<refpurpose>Draw an ellipse</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imageellipse</methodname>
|
|
<methodparam><type>resource</type><parameter>im</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>cx</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>cy</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>w</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>h</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>col</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imageellipse</function> draws an ellipse centered at
|
|
<parameter>cx</parameter>, <parameter>cy</parameter> (top left is
|
|
0, 0) in the image represented by <parameter>im</parameter>.
|
|
<parameter>W</parameter> and <parameter>h</parameter> specifies the
|
|
ellipse's width and height respectively. The color of the ellipse is
|
|
specified by <parameter>color</parameter>.
|
|
</para>
|
|
<note><para>This function was added in PHP 4.0.6 and requires GD 2.0.2 or later</para></note>
|
|
<para>
|
|
See also <function>imagearc</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
|
|
<refentry id="function.imagefilledellipse">
|
|
<refnamediv>
|
|
<refname>imagefilledellipse</refname>
|
|
<refpurpose>Draw a filled ellipse</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagefilledellipse</methodname>
|
|
<methodparam><type>resource</type><parameter>im</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>cx</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>cy</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>w</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>h</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>col</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagefilledellipse</function> draws an ellipse centered at
|
|
<parameter>cx</parameter>, <parameter>cy</parameter> (top left is
|
|
0, 0) in the image represented by <parameter>im</parameter>.
|
|
<parameter>W</parameter> and <parameter>h</parameter> specifies the
|
|
ellipse's width and height respectively. The ellipse is filled using
|
|
<parameter>color</parameter>
|
|
</para>
|
|
<note><para>This function was added in PHP 4.0.6 and requires GD 2.0.1 or later</para></note>
|
|
<para>
|
|
See also <function>imagefilledarc</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagechar">
|
|
<refnamediv>
|
|
<refname>imagechar</refname>
|
|
<refpurpose>Draw a character horizontally</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagechar</methodname>
|
|
<methodparam><type>int</type><parameter>im</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>font</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>x</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>y</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>c</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>col</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagechar</function> 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 <parameter>font</parameter>
|
|
is 1, 2, 3, 4 or 5, a built-in font is used (with higher numbers
|
|
corresponding to larger fonts).
|
|
</para>
|
|
<para>
|
|
See also <function>imageloadfont</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagecharup">
|
|
<refnamediv>
|
|
<refname>imagecharup</refname>
|
|
<refpurpose>Draw a character vertically</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagecharup</methodname>
|
|
<methodparam><type>int</type><parameter>im</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>font</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>x</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>y</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>c</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>col</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagecharup</function> draws the character
|
|
<parameter>c</parameter> vertically in the image identified by
|
|
<parameter>im</parameter> at coordinates
|
|
<parameter>x</parameter>, <parameter>y</parameter> (top left is
|
|
0, 0) with the color <parameter>col</parameter>.
|
|
If <parameter>font</parameter> is 1, 2, 3, 4 or 5, a built-in font is
|
|
used.
|
|
</para>
|
|
<para>
|
|
See also <function>imageloadfont</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagecolorallocate">
|
|
<refnamediv>
|
|
<refname>imagecolorallocate</refname>
|
|
<refpurpose>Allocate a color for an image</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagecolorallocate</methodname>
|
|
<methodparam><type>int</type><parameter>im</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>red</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>green</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>blue</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagecolorallocate</function> returns a color
|
|
identifier representing the color composed of the given
|
|
<acronym>RGB</acronym> components. The <parameter>im</parameter>
|
|
argument is the return from the <function>imagecreate</function>
|
|
function. <parameter>Red</parameter>, <parameter>green</parameter> and
|
|
blue are the values of the red, green and blue component of the requested
|
|
color respectively. These parameters are integers between 0 and 255.
|
|
<function>imagecolorallocate</function> must be called
|
|
to create each color that is to be used in the image represented
|
|
by <parameter>im</parameter>.
|
|
<informalexample>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
$white = imagecolorallocate ($im, 255, 255, 255);
|
|
$black = imagecolorallocate ($im, 0, 0, 0);
|
|
]]>
|
|
</programlisting>
|
|
</informalexample>
|
|
</para>
|
|
<para>
|
|
Returns -1 if the allocation failed.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagecolordeallocate">
|
|
<refnamediv>
|
|
<refname>imagecolordeallocate</refname>
|
|
<refpurpose>De-allocate a color for an image</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagecolordeallocate</methodname>
|
|
<methodparam><type>int</type><parameter>im</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>index</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
The <function>imagecolordeallocate</function> function
|
|
de-allocates a color previously allocated with the
|
|
<function>imagecolorallocate</function> function.
|
|
<informalexample>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
$white = imagecolorallocate ($im, 255, 255, 255);
|
|
imagecolordeallocate ($im, $white);
|
|
]]>
|
|
</programlisting>
|
|
</informalexample>
|
|
</para>
|
|
</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>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagecolorat</methodname>
|
|
<methodparam><type>int</type><parameter>im</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>x</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>y</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Returns the index of the color of the pixel at the
|
|
specified location in the image.
|
|
</para>
|
|
<para>
|
|
See also <function>imagecolorset</function> and
|
|
<function>imagecolorsforindex</function>.
|
|
</para>
|
|
</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>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagecolorclosest</methodname>
|
|
<methodparam><type>int</type><parameter>im</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>red</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>green</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>blue</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Returns the index of the color in the palette of the image which
|
|
is "closest" to the specified <acronym>RGB</acronym> value.
|
|
</para>
|
|
<para>
|
|
The "distance" between the desired color and each color in the
|
|
palette is calculated as if the <acronym>RGB</acronym> values
|
|
represented points in three-dimensional space.
|
|
</para>
|
|
<para>
|
|
See also <function>imagecolorexact</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagecolorclosestalpha">
|
|
<refnamediv>
|
|
<refname>imagecolorclosestalpha</refname>
|
|
<refpurpose>Get the index of the closest color to the specified color + alpha</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagecolorclosestalpha</methodname>
|
|
<methodparam><type>resource</type><parameter>im</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>red</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>green</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>blue</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>alpha</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Returns the index of the color in the palette of the image which
|
|
is "closest" to the specified <acronym>RGB</acronym> value and <parameter>alpha</parameter> level.
|
|
</para>
|
|
<para>
|
|
See also <function>imagecolorexactalpha</function>.
|
|
</para>
|
|
<note><para>This function was added in PHP 4.0.6 and requires GD 2.0.1</para></note>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id='function.imagecolorclosesthwb'>
|
|
<refnamediv>
|
|
<refname>imagecolorclosestthwb</refname>
|
|
<refpurpose>
|
|
Get the index of the color which has the hue, white and blackness nearest to the given color
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagecolorclosesthwb</methodname>
|
|
<methodparam><type>int</type><parameter>im</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>red</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>green</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>blue</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
&warn.undocumented.func;
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagecolorexact">
|
|
<refnamediv>
|
|
<refname>imagecolorexact</refname>
|
|
<refpurpose>Get the index of the specified color</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagecolorexact</methodname>
|
|
<methodparam><type>int</type><parameter>im</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>red</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>green</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>blue</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Returns the index of the specified color in the palette of the
|
|
image.
|
|
</para>
|
|
<para>
|
|
If the color does not exist in the image's palette, -1 is
|
|
returned.
|
|
</para>
|
|
<para>
|
|
See also <function>imagecolorclosest</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagecolorexactalpha">
|
|
<refnamediv>
|
|
<refname>imagecolorexactalpha</refname>
|
|
<refpurpose>Get the index of the specified color + alpha</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagecolorexactalpha</methodname>
|
|
<methodparam><type>resource</type><parameter>im</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>red</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>green</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>blue</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>alpha</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Returns the index of the specified color+alpha in the palette of the
|
|
image.
|
|
</para>
|
|
<para>
|
|
If the color does not exist in the image's palette, -1 is
|
|
returned.
|
|
</para>
|
|
<para>
|
|
See also <function>imagecolorclosestalpha</function>.
|
|
</para>
|
|
<note><para>This function was added in PHP 4.0.6 and requires GD 2.0.1 or later</para></note>
|
|
</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>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagecolorresolve</methodname>
|
|
<methodparam><type>int</type><parameter>im</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>red</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>green</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>blue</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
This function is guaranteed to return a color index for a
|
|
requested color, either the exact color or the closest possible
|
|
alternative.
|
|
</para>
|
|
<para>
|
|
See also <function>imagecolorclosest</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagecolorresolvealpha">
|
|
<refnamediv>
|
|
<refname>imagecolorresolvealpha</refname>
|
|
<refpurpose>
|
|
Get the index of the specified color + alpha or its closest possible
|
|
alternative
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagecolorresolvealpha</methodname>
|
|
<methodparam><type>resource</type><parameter>im</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>red</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>green</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>blue</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>alpha</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
This function is guaranteed to return a color index for a
|
|
requested color, either the exact color or the closest possible
|
|
alternative.
|
|
</para>
|
|
<para>
|
|
See also <function>imagecolorclosestalpha</function>.
|
|
</para>
|
|
<note><para>This function was added in PHP 4.0.6 and requires GD 2.0.1</para></note>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
|
|
|
|
<refentry id="function.imagegammacorrect">
|
|
<refnamediv>
|
|
<refname>imagegammacorrect</refname>
|
|
<refpurpose>Apply a gamma correction to a GD image</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagegammacorrect</methodname>
|
|
<methodparam><type>int</type><parameter>im</parameter></methodparam>
|
|
<methodparam><type>float</type><parameter>inputgamma</parameter></methodparam>
|
|
<methodparam><type>float</type><parameter>outputgamma</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
The <function>imagegammacorrect</function> function applies gamma
|
|
correction to a gd image stream (<parameter>im</parameter>) given
|
|
an input gamma, the parameter <parameter>inputgamma</parameter>
|
|
and an output gamma, the parameter
|
|
<parameter>outputgamma</parameter>.
|
|
</para>
|
|
</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>
|
|
<methodsynopsis>
|
|
<type>bool</type><methodname>imagecolorset</methodname>
|
|
<methodparam><type>int</type><parameter>im</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>index</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>red</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>green</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>blue</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<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>
|
|
<para>
|
|
See also <function>imagecolorat</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagecolorsforindex">
|
|
<refnamediv>
|
|
<refname>imagecolorsforindex</refname>
|
|
<refpurpose>Get the colors for an index</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>imagecolorsforindex</methodname>
|
|
<methodparam><type>int</type><parameter>im</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>index</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
This returns an associative array with red, green, and blue keys
|
|
that contain the appropriate values for the specified color
|
|
index.
|
|
</para>
|
|
<para>
|
|
See also <function>imagecolorat</function> and
|
|
<function>imagecolorexact</function>.
|
|
</para>
|
|
</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>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagecolorstotal</methodname>
|
|
<methodparam><type>int</type><parameter>im</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
This returns the number of colors in the specified image's
|
|
palette.
|
|
</para>
|
|
<para>
|
|
See also <function>imagecolorat</function> and
|
|
<function>imagecolorsforindex</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagecolortransparent">
|
|
<refnamediv>
|
|
<refname>imagecolortransparent</refname>
|
|
<refpurpose>Define a color as transparent</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagecolortransparent</methodname>
|
|
<methodparam><type>int</type><parameter>im</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>col</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagecolortransparent</function> sets the transparent
|
|
color in the <parameter>im</parameter> image to
|
|
<parameter>col</parameter>. <parameter>im</parameter> is the
|
|
image identifier returned by <function>imagecreate</function> and
|
|
<parameter>col</parameter> is a color identifier returned by
|
|
<function>imagecolorallocate</function>.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
The transparent color is a property of the image, transparency is not a
|
|
property of the color. Once you have a set a color to be the transparent
|
|
color, any regions of the image in that color that were drawn previously
|
|
will be transparent.
|
|
</para>
|
|
</note>
|
|
<para>
|
|
The identifier of the new (or current, if none is specified)
|
|
transparent color is returned.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagecopy">
|
|
<refnamediv>
|
|
<refname>imagecopy</refname>
|
|
<refpurpose>Copy part of an image</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagecopy</methodname>
|
|
<methodparam><type>resource</type><parameter>dst_im</parameter></methodparam>
|
|
<methodparam><type>resource</type><parameter>src_im</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>dst_x</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>dst_y</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>src_x</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>src_y</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>src_w</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>src_h</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Copy a part of <parameter>src_im</parameter> onto
|
|
<parameter>dst_im</parameter> starting at the x,y coordinates
|
|
<parameter>src_x</parameter>, <parameter>src_y </parameter> with
|
|
a width of <parameter>src_w</parameter> and a height of
|
|
<parameter>src_h</parameter>. The portion defined will be copied
|
|
onto the x,y coordinates, <parameter>dst_x</parameter> and
|
|
<parameter>dst_y</parameter>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagecopymerge">
|
|
<refnamediv>
|
|
<refname>imagecopymerge</refname>
|
|
<refpurpose>Copy and merge part of an image</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagecopymerge</methodname>
|
|
<methodparam><type>resource</type><parameter>dst_im</parameter></methodparam>
|
|
<methodparam><type>resource</type><parameter>src_im</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>dst_x</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>dst_y</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>src_x</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>src_y</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>src_w</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>src_h</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>pct</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Copy a part of <parameter>src_im</parameter> onto
|
|
<parameter>dst_im</parameter> starting at the x,y coordinates
|
|
<parameter>src_x</parameter>, <parameter>src_y </parameter> with
|
|
a width of <parameter>src_w</parameter> and a height of
|
|
<parameter>src_h</parameter>. The portion defined will be copied
|
|
onto the x,y coordinates, <parameter>dst_x</parameter> and
|
|
<parameter>dst_y</parameter>.
|
|
The two images will be merged according to <parameter>pct</parameter>
|
|
which can range from 0 to 100. When <parameter>pct</parameter> = 0,
|
|
no action is taken, when 100 this function behaves identically
|
|
to <function>imagecopy</function>.
|
|
</para>
|
|
<note><para>This function was added in PHP 4.0.6</para></note>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagecopymergegray">
|
|
<refnamediv>
|
|
<refname>imagecopymergegray</refname>
|
|
<refpurpose>Copy and merge part of an image with gray scale</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagecopymergegray</methodname>
|
|
<methodparam><type>resource</type><parameter>dst_im</parameter></methodparam>
|
|
<methodparam><type>resource</type><parameter>src_im</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>dst_x</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>dst_y</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>src_x</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>src_y</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>src_w</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>src_h</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>pct</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagecopymergegray</function> copy a part of <parameter>src_im</parameter> onto
|
|
<parameter>dst_im</parameter> starting at the x,y coordinates
|
|
<parameter>src_x</parameter>, <parameter>src_y </parameter> with
|
|
a width of <parameter>src_w</parameter> and a height of
|
|
<parameter>src_h</parameter>. The portion defined will be copied
|
|
onto the x,y coordinates, <parameter>dst_x</parameter> and
|
|
<parameter>dst_y</parameter>.
|
|
The two images will be merged according to <parameter>pct</parameter>
|
|
which can range from 0 to 100. When <parameter>pct</parameter> = 0,
|
|
no action is taken, when 100 this function behaves identically
|
|
to <function>imagecopy</function>.
|
|
</para>
|
|
<para>
|
|
This function is identical to <function>imagecopymerge</function> except
|
|
that when merging it preservese the hue of the source by converting
|
|
the destination pixels to gray scale before the copy operation.
|
|
</para>
|
|
<note><para>This function was added in PHP 4.0.6</para></note>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagecopyresized">
|
|
<refnamediv>
|
|
<refname>imagecopyresized</refname>
|
|
<refpurpose>Copy and resize part of an image</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagecopyresized</methodname>
|
|
<methodparam><type>resource</type><parameter>dst_im</parameter></methodparam>
|
|
<methodparam><type>resource</type><parameter>src_im</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>dstX</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>dstY</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>srcX</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>srcY</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>dstW</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>dstH</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>srcW</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>srcH</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagecopyresized</function> 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.
|
|
</para>
|
|
<para>
|
|
See also <function>imagecopyresampled</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagecopyresampled">
|
|
<refnamediv>
|
|
<refname>imagecopyresampled</refname>
|
|
<refpurpose>Copy and resize part of an image with resampling</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagecopyresampled</methodname>
|
|
<methodparam><type>resource</type><parameter>dst_im</parameter></methodparam>
|
|
<methodparam><type>resource</type><parameter>src_im</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>dstX</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>dstY</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>srcX</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>srcY</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>dstW</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>dstH</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>srcW</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>srcH</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagecopyresampled</function> copies a rectangular
|
|
portion of one image to another image, smoothly interpolating pixel
|
|
values so that, in particular, reducing the size of an image still
|
|
retains a great deal of clarity.
|
|
<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.
|
|
</para>
|
|
<para>
|
|
See also <function>imagecopyresized</function>.
|
|
</para>
|
|
<note><para>This function was added in PHP 4.0.6 and requires GD 2.0.1 or later</para></note>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagecreate">
|
|
<refnamediv>
|
|
<refname>imagecreate</refname>
|
|
<refpurpose>Create a new palette based image</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagecreate</methodname>
|
|
<methodparam><type>int</type><parameter>x_size</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>y_size</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagecreate</function> returns an image identifier
|
|
representing a blank image of size <parameter>x_size</parameter>
|
|
by <parameter>y_size</parameter>.
|
|
<example>
|
|
<title>
|
|
Creating a new GD image stream and outputting an image.
|
|
</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
header ("Content-type: image/png");
|
|
$im = @imagecreate (50, 100)
|
|
or die ("Cannot Initialize new GD image stream");
|
|
$background_color = imagecolorallocate ($im, 255, 255, 255);
|
|
$text_color = imagecolorallocate ($im, 233, 14, 91);
|
|
imagestring ($im, 1, 5, 5, "A Simple Text String", $text_color);
|
|
imagepng ($im);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagecreatetruecolor">
|
|
<refnamediv>
|
|
<refname>imagecreatetruecolor</refname>
|
|
<refpurpose>Create a new true color image</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>resource</type><methodname>imagecreatetruecolor</methodname>
|
|
<methodparam><type>int</type><parameter>x_size</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>y_size</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagecreatetruecolor</function> returns an image identifier
|
|
representing a black image of size <parameter>x_size</parameter>
|
|
by <parameter>y_size</parameter>.
|
|
</para>
|
|
<note><para>This function was added in PHP 4.0.6 and requires GD 2.0.1 or later</para></note>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagetruecolortopalette">
|
|
<refnamediv>
|
|
<refname>imagetruecolortopalette</refname>
|
|
<refpurpose>Convert a true color image to a palette image</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>void</type><methodname>imagetruecolortopalette</methodname>
|
|
<methodparam><type>resource</type><parameter>im</parameter></methodparam>
|
|
<methodparam><type>bool</type><parameter>dither</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>ncolors</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagetruecolortopalette</function> converts a truecolor image
|
|
to a palette image. The code for this function was originally drawn from
|
|
the Independent JPEG Group library code, which is excellent. The code
|
|
has been modified to preserve as much alpha channel information as
|
|
possible in the resulting palette, in addition to preserving colors as
|
|
well as possible. This does not work as well as might be hoped. It is
|
|
usually best to simply produce a truecolor output image instead, which
|
|
guarantees the highest output quality.
|
|
</para>
|
|
<para>
|
|
<parameter>dither</parameter> indicates if the image should be dithered -
|
|
if it is &true; then dithering will be used which will result in a more
|
|
speckled image but with better color approximation.
|
|
</para>
|
|
<para>
|
|
<parameter>ncolors</parameter> sets the maximum number of colors that
|
|
should be retained in the palette.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
This function was added in PHP 4.0.6 and requires GD 2.0.1 or later
|
|
</para>
|
|
</note>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id='function.imagecreatefromgd'>
|
|
<refnamediv>
|
|
<refname>imagecreatefromgd</refname>
|
|
<refpurpose>Create a new image from GD file or URL</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagecreatefromgd</methodname>
|
|
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
&warn.undocumented.func;
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id='function.imagecreatefromgd2'>
|
|
<refnamediv>
|
|
<refname>imagecreatefromgd2</refname>
|
|
<refpurpose>Create a new image from GD2 file or URL</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagecreatefromgd2</methodname>
|
|
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
&warn.undocumented.func;
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id='function.imagecreatefromgd2part'>
|
|
<refnamediv>
|
|
<refname>imagecreatefromgd2part</refname>
|
|
<refpurpose>Create a new image from a given part of GD2 file or URL</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagecreatefromgd2part</methodname>
|
|
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>srcX</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>srcY</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>width</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>height</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
&warn.undocumented.func;
|
|
</para>
|
|
</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>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagecreatefromgif</methodname>
|
|
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagecreatefromgif</function> returns an image identifier
|
|
representing the image obtained from the given filename.
|
|
</para>
|
|
<para>
|
|
<function>imagecreatefromgif</function> 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">
|
|
<![CDATA[
|
|
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;
|
|
}
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
<note>
|
|
<para>
|
|
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.
|
|
</para>
|
|
</note>
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagecreatefromjpeg">
|
|
<refnamediv>
|
|
<refname>imagecreatefromjpeg</refname>
|
|
<refpurpose>Create a new image from file or URL</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagecreatefromjpeg</methodname>
|
|
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagecreatefromjpeg</function> returns an image identifier
|
|
representing the image obtained from the given filename.
|
|
</para>
|
|
<para>
|
|
<function>imagecreatefromjpeg</function> 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 <acronym>JPEG</acronym>:
|
|
<example>
|
|
<title>
|
|
Example to handle an error during creation (courtesy
|
|
vic@zymsys.com )
|
|
</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
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;
|
|
}
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagecreatefrompng">
|
|
<refnamediv>
|
|
<refname>imagecreatefrompng</refname>
|
|
<refpurpose>Create a new image from file or URL</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagecreatefrompng</methodname>
|
|
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagecreatefrompng</function> returns an image identifier
|
|
representing the image obtained from the given filename.
|
|
</para>
|
|
<para>
|
|
<function>imagecreatefrompng</function> 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 <acronym>PNG</acronym>:
|
|
<example>
|
|
<title>
|
|
Example to handle an error during creation (courtesy
|
|
vic@zymsys.com)
|
|
</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
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;
|
|
}
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagecreatefromwbmp">
|
|
<refnamediv>
|
|
<refname>imagecreatefromwbmp</refname>
|
|
<refpurpose>Create a new image from file or URL</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagecreatefromwbmp</methodname>
|
|
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagecreatefromwbmp</function> returns an image identifier
|
|
representing the image obtained from the given filename.
|
|
</para>
|
|
<para>
|
|
<function>imagecreatefromwbmp</function> 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 <acronym>WBMP</acronym>:
|
|
<example>
|
|
<title>
|
|
Example to handle an error during creation (courtesy
|
|
vic@zymsys.com)
|
|
</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
function LoadWBMP ($imgname) {
|
|
$im = @imagecreatefromwbmp ($imgname); /* Attempt to open */
|
|
if (!$im) { /* See if it failed */
|
|
$im = imagecreate (20, 20); /* Create a blank image */
|
|
$bgc = imagecolorallocate ($im, 255, 255, 255);
|
|
$tc = imagecolorallocate ($im, 0, 0, 0);
|
|
imagefilledrectangle ($im, 0, 0, 10, 10, $bgc);
|
|
/* Output an errmsg */
|
|
imagestring ($im, 1, 5, 5, "Error loading $imgname", $tc);
|
|
}
|
|
return $im;
|
|
}
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<note>
|
|
<para>
|
|
WBMP support is only available if PHP was compiled
|
|
against GD-1.8 or later.
|
|
</para>
|
|
</note>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagecreatefromstring">
|
|
<refnamediv>
|
|
<refname>imagecreatefromstring</refname>
|
|
<refpurpose>Create a new image from the image stream in the string</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagecreatefromstring</methodname>
|
|
<methodparam><type>string</type><parameter>image</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagecreatefromstring</function> returns an image identifier
|
|
representing the image obtained from the given string.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagecreatefromxbm">
|
|
<refnamediv>
|
|
<refname>imagecreatefromxbm</refname>
|
|
<refpurpose>Create a new image from file or URL</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagecreatefromxbm</methodname>
|
|
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagecreatefromxbm</function> returns an image identifier
|
|
representing the image obtained from the given filename.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagecreatefromxpm">
|
|
<refnamediv>
|
|
<refname>imagecreatefromxpm</refname>
|
|
<refpurpose>Create a new image from file or URL</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagecreatefromxpm</methodname>
|
|
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagecreatefromxpm</function> returns an image identifier
|
|
representing the image obtained from the given filename.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagedashedline">
|
|
<refnamediv>
|
|
<refname>imagedashedline</refname>
|
|
<refpurpose>Draw a dashed line</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagedashedline</methodname>
|
|
<methodparam><type>int</type><parameter>im</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>x1</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>y1</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>x2</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>y2</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>col</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
This function is deprecated. Use combination of
|
|
<function>imagesetstyle</function> and <function>ImageLine</function>
|
|
instead.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagedestroy">
|
|
<refnamediv>
|
|
<refname>imagedestroy</refname>
|
|
<refpurpose>Destroy an image</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagedestroy</methodname>
|
|
<methodparam><type>int</type><parameter>im</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagedestroy</function> frees any memory associated
|
|
with image <parameter>im</parameter>. <parameter>Im</parameter>
|
|
is the image identifier returned by the
|
|
<function>imagecreate</function> function.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagefill">
|
|
<refnamediv>
|
|
<refname>imagefill</refname>
|
|
<refpurpose>Flood fill</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagefill</methodname>
|
|
<methodparam><type>int</type><parameter>im</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>x</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>y</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>col</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagefill</function> performs a flood fill starting at
|
|
coordinate <parameter>x</parameter>, <parameter>y</parameter>
|
|
(top left is 0, 0) with color <parameter>col</parameter> in the
|
|
image <parameter>im</parameter>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagefilledpolygon">
|
|
<refnamediv>
|
|
<refname>imagefilledpolygon</refname>
|
|
<refpurpose>Draw a filled polygon</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagefilledpolygon</methodname>
|
|
<methodparam><type>int</type><parameter>im</parameter></methodparam>
|
|
<methodparam><type>array</type><parameter>points</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>num_points</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>col</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagefilledpolygon</function> creates a filled polygon
|
|
in image <parameter>im</parameter>.
|
|
<parameter>Points</parameter> is a PHP array containing the
|
|
polygon's vertices, ie. points[0] = x0, points[1] = y0, points[2]
|
|
= x1, points[3] = y1, etc. <parameter>Num_points</parameter> is
|
|
the total number of vertices.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagefilledrectangle">
|
|
<refnamediv>
|
|
<refname>imagefilledrectangle</refname>
|
|
<refpurpose>Draw a filled rectangle</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagefilledrectangle</methodname>
|
|
<methodparam><type>int</type><parameter>im</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>x1</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>y1</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>x2</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>y2</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>col</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagefilledrectangle</function> creates a filled
|
|
rectangle of color <parameter>col</parameter> in image
|
|
<parameter>im</parameter> starting at upper left coordinates
|
|
<parameter>x1</parameter>, <parameter>y1</parameter> and ending
|
|
at bottom right coordinates <parameter>x2</parameter>,
|
|
<parameter>y2</parameter>. 0, 0 is the top left corner of the
|
|
image.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagefilltoborder">
|
|
<refnamediv>
|
|
<refname>imagefilltoborder</refname>
|
|
<refpurpose>Flood fill to specific color</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagefilltoborder</methodname>
|
|
<methodparam><type>int</type><parameter>im</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>x</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>y</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>border</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>col</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagefilltoborder</function> performs a flood fill
|
|
whose border color is defined by <parameter>border</parameter>.
|
|
The starting point for the fill is <parameter>x</parameter>,
|
|
<parameter>y</parameter> (top left is 0, 0) and the region is
|
|
filled with color <parameter>col</parameter>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagefontheight">
|
|
<refnamediv>
|
|
<refname>imagefontheight</refname>
|
|
<refpurpose>Get font height</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagefontheight</methodname>
|
|
<methodparam><type>int</type><parameter>font</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Returns the pixel height of a character in the specified font.
|
|
</para>
|
|
<para>
|
|
See also <function>imagefontwidth</function> and
|
|
<function>imageloadfont</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagefontwidth">
|
|
<refnamediv>
|
|
<refname>imagefontwidth</refname>
|
|
<refpurpose>Get font width</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagefontwidth</methodname>
|
|
<methodparam><type>int</type><parameter>font</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Returns the pixel width of a character in font.
|
|
</para>
|
|
<para>
|
|
See also <function>imagefontheight</function> and
|
|
<function>imageloadfont</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id='function.imagegd'>
|
|
<refnamediv>
|
|
<refname>imagegd</refname>
|
|
<refpurpose>Output GD image to browser or file</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagegd</methodname>
|
|
<methodparam><type>int</type><parameter>im</parameter></methodparam>
|
|
<methodparam choice="opt"><type>string</type><parameter>filename</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
&warn.undocumented.func;
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id='function.imagegd2'>
|
|
<refnamediv>
|
|
<refname>imagegd2</refname>
|
|
<refpurpose>Output GD2 image to browser or file</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagegd2</methodname>
|
|
<methodparam><type>int</type><parameter>im</parameter></methodparam>
|
|
<methodparam choice="opt"><type>string</type><parameter>filename</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
&warn.undocumented.func;
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagegif">
|
|
<refnamediv>
|
|
<refname>imagegif</refname>
|
|
<refpurpose>Output image to browser or file</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagegif</methodname>
|
|
<methodparam><type>int</type><parameter>im</parameter></methodparam>
|
|
<methodparam choice="opt"><type>string</type><parameter>filename</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagegif</function> creates the <acronym>GIF</acronym>
|
|
file in filename from the image <parameter>im</parameter>. The
|
|
<parameter>im</parameter> argument is the return from the
|
|
<function>imagecreate</function> function.
|
|
</para>
|
|
<para>
|
|
The image format will be <acronym>GIF87a</acronym> unless the
|
|
image has been made transparent with
|
|
<function>imagecolortransparent</function>, in which case the
|
|
image format will be <acronym>GIF89a</acronym>.
|
|
</para>
|
|
<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 <function>header</function>, you can create a
|
|
PHP script that outputs <acronym>GIF</acronym> images directly.
|
|
<note>
|
|
<para>
|
|
Since all <acronym>GIF</acronym> support was removed from the
|
|
<acronym>GD</acronym> library in version 1.6, this function is
|
|
not available if you are using that version of the GD library.
|
|
</para>
|
|
<para>
|
|
The following code snippet allows you to write more
|
|
portable PHP applications by auto-detecting the
|
|
type of GD support which is available. Replace
|
|
the sequence <literal>header ("Content-type: image/gif");
|
|
imagegif ($im);</literal> by the more flexible sequence:
|
|
<informalexample>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
if (function_exists("imagegif")) {
|
|
header ("Content-type: image/gif");
|
|
imagegif ($im);
|
|
}
|
|
elseif (function_exists("imagejpeg")) {
|
|
header ("Content-type: image/jpeg");
|
|
imagejpeg ($im, "", 0.5);
|
|
}
|
|
elseif (function_exists("imagepng")) {
|
|
header ("Content-type: image/png");
|
|
imagepng ($im);
|
|
}
|
|
elseif (function_exists("imagewbmp")) {
|
|
header ("Content-type: image/vnd.wap.wbmp");
|
|
imagewbmp ($im);
|
|
}
|
|
else
|
|
die("No image support in this PHP server");
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</informalexample>
|
|
</para>
|
|
</note>
|
|
<note>
|
|
<para>
|
|
As of version 3.0.18 and 4.0.2 you can use the function
|
|
<function>imagetypes</function> in place of
|
|
<function>function_exists</function> for checking
|
|
the presence of the various supported image formats:
|
|
<informalexample>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
if (imagetypes() & IMG_GIF) {
|
|
header ("Content-type: image/gif");
|
|
imagegif ($im);
|
|
}
|
|
elseif (imagetypes() & IMG_JPG) {
|
|
... etc.
|
|
]]>
|
|
</programlisting>
|
|
</informalexample>
|
|
</para>
|
|
</note>
|
|
</para>
|
|
<para>
|
|
See also <function>imagepng</function>, <function>imagewbmp</function>,
|
|
<function>imagejpeg</function>, <function>imagetypes</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagepng">
|
|
<refnamediv>
|
|
<refname>imagepng</refname>
|
|
<refpurpose>Output a PNG image to either the browser or a file</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagepng</methodname>
|
|
<methodparam><type>int</type><parameter>im</parameter></methodparam>
|
|
<methodparam choice="opt"><type>string</type><parameter>filename</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
The <function>imagepng</function> outputs a GD image stream
|
|
(<parameter>im</parameter>) in PNG format to standard output
|
|
(usually the browser) or, if a filename is given by the
|
|
<parameter>filename</parameter> it outputs the image to the file.
|
|
<informalexample>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$im = imagecreatefrompng ("test.png");
|
|
imagepng ($im);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</informalexample>
|
|
</para>
|
|
<para>
|
|
See also <function>imagegif</function>, <function>imagewbmp</function>,
|
|
<function>imagejpeg</function>, <function>imagetypes</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagejpeg">
|
|
<refnamediv>
|
|
<refname>imagejpeg</refname>
|
|
<refpurpose>Output image to browser or file</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagejpeg</methodname>
|
|
<methodparam><type>int</type><parameter>im</parameter></methodparam>
|
|
<methodparam choice="opt"><type>string</type><parameter>filename</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>quality</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagejpeg</function> creates the
|
|
<acronym>JPEG</acronym> file in filename from the image
|
|
<parameter>im</parameter>. The <parameter>im</parameter> argument
|
|
is the return from the <function>imagecreate</function> function.
|
|
</para>
|
|
<para>
|
|
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/jpeg content-type using
|
|
<function>header</function>, you can create a PHP script that
|
|
outputs JPEG images directly.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
JPEG support is only available if PHP was compiled
|
|
against GD-1.8 or later.
|
|
</para>
|
|
</note>
|
|
<para>
|
|
<parameter>quality</parameter> is optional, and ranges from
|
|
0 (worst quality, smaller file) to 100 (best quality, biggest file).
|
|
The default is the default IJG quality value (about 75).
|
|
</para>
|
|
<para>
|
|
If you want to output Progressive JPEGs, you need to set interlacing
|
|
on with <function>imageinterlace</function>.
|
|
</para>
|
|
<para>
|
|
See also
|
|
<function>imagepng</function>,
|
|
<function>imagegif</function>,
|
|
<function>imagewbmp</function>,
|
|
<function>imageinterlace</function> and
|
|
<function>imagetypes</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagewbmp">
|
|
<refnamediv>
|
|
<refname>imagewbmp</refname>
|
|
<refpurpose>Output image to browser or file</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagewbmp</methodname>
|
|
<methodparam><type>int</type><parameter>im</parameter></methodparam>
|
|
<methodparam choice="opt"><type>string</type><parameter>filename</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>foreground</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagewbmp</function> creates the
|
|
<acronym>WBMP</acronym> file in filename from the image
|
|
<parameter>im</parameter>. The <parameter>im</parameter> argument
|
|
is the return from the <function>imagecreate</function> function.
|
|
</para>
|
|
<para>
|
|
The filename argument is optional, and if left off, the raw image
|
|
stream will be output directly.
|
|
By sending an <acronym>image/vnd.wap.wbmp</acronym> content-type
|
|
using <function>header</function>, you can create
|
|
a PHP script that outputs WBMP images directly.
|
|
<note>
|
|
<para>
|
|
WBMP support is only available if PHP was compiled
|
|
against GD-1.8 or later.
|
|
</para>
|
|
</note>
|
|
</para>
|
|
<para>
|
|
Using the optional <parameter>foreground</parameter>
|
|
parameter, you can set the foreground color. Use an
|
|
identifier obtained from <function>imagecolorallocate</function>.
|
|
The default foreground color is black.
|
|
</para>
|
|
<para>
|
|
See also <function>image2wbmp</function>, <function>imagepng</function>,
|
|
<function>imagegif</function>, <function>imagejpeg</function>,
|
|
<function>imagetypes</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imageinterlace">
|
|
<refnamediv>
|
|
<refname>imageinterlace</refname>
|
|
<refpurpose>Enable or disable interlace</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imageinterlace</methodname>
|
|
<methodparam><type>int</type><parameter>im</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>interlace</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<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>
|
|
<para>
|
|
If the interlace bit is set and the image is used as a JPEG image,
|
|
the image is created as a progressive JPEG.
|
|
</para>
|
|
<para>
|
|
This function returns whether the interlace bit is set for the
|
|
image.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imageline">
|
|
<refnamediv>
|
|
<refname>imageline</refname>
|
|
<refpurpose>Draw a line</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imageline</methodname>
|
|
<methodparam><type>int</type><parameter>im</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>x1</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>y1</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>x2</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>y2</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>col</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imageline</function> draws a line from
|
|
<parameter>x1</parameter>, <parameter>y1</parameter> to
|
|
<parameter>x2</parameter>, <parameter>y2</parameter> (top left is
|
|
0, 0) in image im of color <parameter>col</parameter>.
|
|
</para>
|
|
<para>
|
|
See also <function>imagecreate</function> and
|
|
<function>imagecolorallocate</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imageloadfont">
|
|
<refnamediv>
|
|
<refname>imageloadfont</refname>
|
|
<refpurpose>Load a new font</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imageloadfont</methodname>
|
|
<methodparam><type>string</type><parameter>file</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imageloadfont</function> 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>
|
|
<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>
|
|
<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>
|
|
<para>
|
|
See also <function>imagefontwidth</function> and
|
|
<function>imagefontheight</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagepalettecopy">
|
|
<refnamediv>
|
|
<refname>imagepalettecopy</refname>
|
|
<refpurpose>Copy the palette from one image to another</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagepalettecopy</methodname>
|
|
<methodparam><type>resource</type><parameter>destination</parameter></methodparam>
|
|
<methodparam><type>resource</type><parameter>source</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagepalettecopy</function> copies the
|
|
palette from the <parameter>source</parameter> image
|
|
to the <parameter>destination</parameter> image.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagepolygon">
|
|
<refnamediv>
|
|
<refname>imagepolygon</refname>
|
|
<refpurpose>Draw a polygon</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagepolygon</methodname>
|
|
<methodparam><type>int</type><parameter>im</parameter></methodparam>
|
|
<methodparam><type>array</type><parameter>points</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>num_points</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>col</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagepolygon</function> creates a polygon in image id.
|
|
<parameter>Points</parameter> is a PHP array containing the
|
|
polygon's vertices, ie. points[0] = x0, points[1] = y0, points[2]
|
|
= x1, points[3] = y1, etc. <parameter>Num_points</parameter> is
|
|
the total number of vertices.
|
|
</para>
|
|
<para>
|
|
See also <function>imagecreate</function>.
|
|
</para>
|
|
</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>
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>imagepsbbox</methodname>
|
|
<methodparam><type>string</type><parameter>text</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>font</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>size</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>space</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>tightness</parameter></methodparam>
|
|
<methodparam choice="opt"><type>float</type><parameter>angle</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<parameter>Size</parameter> is expressed in pixels.
|
|
</para>
|
|
<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>
|
|
<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>
|
|
<para>
|
|
<parameter>Angle</parameter> is in degrees.
|
|
</para>
|
|
<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>
|
|
<para>
|
|
Parameters <parameter>space</parameter>,
|
|
<parameter>tightness</parameter>, and <parameter>angle</parameter>
|
|
are optional.
|
|
</para>
|
|
<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>
|
|
<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>
|
|
<para>
|
|
See also <function>imagepstext</function>.
|
|
</para>
|
|
</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>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagepscopyfont</methodname>
|
|
<methodparam><type>int</type><parameter>fontindex</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<para>
|
|
See also <function>ImagePSLoadFont</function>.
|
|
</para>
|
|
</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>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagepsencodefont</methodname>
|
|
<methodparam><type>int</type><parameter>font_index</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>encodingfile</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<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>
|
|
<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
|
|
the <link linkend="configuration.file">configuration file</link>
|
|
to point to the right encoding file and all fonts you load will
|
|
automatically have the right encoding.
|
|
</para>
|
|
</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>
|
|
<methodsynopsis>
|
|
<type>void</type><methodname>imagepsfreefont</methodname>
|
|
<methodparam><type>int</type><parameter>fontindex</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
See also <function>imagepsloadfont</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagepsloadfont">
|
|
<refnamediv>
|
|
<refname>imagepsloadfont</refname>
|
|
<refpurpose>Load a PostScript Type 1 font from file</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagepsloadfont</methodname>
|
|
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<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, which you cannot read directly, while the output type is image.
|
|
</para>
|
|
<para>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
header ("Content-type: image/jpeg");
|
|
$im = imagecreate (350, 45);
|
|
$black = imagecolorallocate ($im, 0, 0, 0);
|
|
$white = imagecolorallocate ($im, 255, 255, 255);
|
|
$font = imagepsloadfont ("bchbi.pfb"); // or locate your .pfb files on your machine
|
|
imagepstext ($im, "Testing... It worked!", $font, 32, $white, $black, 32, 32);
|
|
imagepsfreefont ($font);
|
|
imagejpeg ($im, "", 100); //for best quality...your mileage may vary
|
|
imagedestroy ($im);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</para>
|
|
<para>
|
|
See also <function>imagepsfreefont</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagepsextendfont">
|
|
<refnamediv>
|
|
<refname>imagepsextendfont</refname>
|
|
<refpurpose>Extend or condense a font</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>bool</type><methodname>imagepsextendfont</methodname>
|
|
<methodparam><type>int</type><parameter>font_index</parameter></methodparam>
|
|
<methodparam><type>float</type><parameter>extend</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Extend or condense a font (<parameter>font_index</parameter>), if
|
|
the value of the <parameter>extend</parameter> parameter is less
|
|
than one you will be condensing the font.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagepsslantfont">
|
|
<refnamediv>
|
|
<refname>imagepsslantfont</refname>
|
|
<refpurpose>Slant a font</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>bool</type><methodname>imagepsslantfont</methodname>
|
|
<methodparam><type>int</type><parameter>font_index</parameter></methodparam>
|
|
<methodparam><type>float</type><parameter>slant</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Slant a font given by the <parameter>font_index</parameter>
|
|
parameter with a slant of the value of the
|
|
<parameter>slant</parameter> parameter.
|
|
</para>
|
|
</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>Description</title>
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>imagepstext</methodname>
|
|
<methodparam><type>int</type><parameter>image</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>text</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>font</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>size</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>foreground</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>background</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>x</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>y</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>
|
|
space
|
|
</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>
|
|
tightness
|
|
</parameter></methodparam>
|
|
<methodparam choice="opt"><type>float</type><parameter>
|
|
angle
|
|
</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>
|
|
antialias_steps
|
|
</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<parameter>Size</parameter> is expressed in pixels.
|
|
</para>
|
|
<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>
|
|
<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 <parameter>x</parameter>,
|
|
<parameter>y</parameter> 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>
|
|
<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>
|
|
<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>
|
|
<para>
|
|
<parameter>Angle</parameter> is in degrees.
|
|
</para>
|
|
<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>
|
|
<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>
|
|
<para>
|
|
Parameters <parameter>space</parameter>,
|
|
<parameter>tightness</parameter>, <parameter>angle</parameter>
|
|
and <parameter>antialias</parameter> are optional.
|
|
</para>
|
|
<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>
|
|
<para>
|
|
See also <function>imagepsbbox</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagerectangle">
|
|
<refnamediv>
|
|
<refname>imagerectangle</refname>
|
|
<refpurpose>Draw a rectangle</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagerectangle</methodname>
|
|
<methodparam><type>int</type><parameter>im</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>x1</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>y1</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>x2</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>y2</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>col</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagerectangle</function> 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.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagesetpixel">
|
|
<refnamediv>
|
|
<refname>imagesetpixel</refname>
|
|
<refpurpose>Set a single pixel</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagesetpixel</methodname>
|
|
<methodparam><type>int</type><parameter>im</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>x</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>y</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>col</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagesetpixel</function> draws a pixel at
|
|
<parameter>x</parameter>, <parameter>y</parameter> (top left is
|
|
0, 0) in image <parameter>im</parameter> of color
|
|
<parameter>col</parameter>.
|
|
</para>
|
|
<para>
|
|
See also <function>imagecreate</function> and
|
|
<function>imagecolorallocate</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagesetbrush">
|
|
<refnamediv>
|
|
<refname>imagesetbrush</refname>
|
|
<refpurpose>Set the brush image for line drawing</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagesetbrush</methodname>
|
|
<methodparam><type>resource</type><parameter>im</parameter></methodparam>
|
|
<methodparam><type>resource</type><parameter>brush</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagesetbrush</function> sets the brush image to be
|
|
used by all line drawing functions (such as <function>imageline</function>
|
|
and <function>imagepolygon</function>) when drawing with the special
|
|
colors <literal>IMG_COLOR_BRUSHED</literal> or <literal>IMG_COLOR_STYLEDBRUSHED</literal>.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
You need not take special action when you are finished with a brush, but if you
|
|
destroy the brush image, you must not use the <literal>IMG_COLOR_BRUSHED</literal> or
|
|
<literal>IMG_COLOR_STYLEDBRUSHED</literal>
|
|
colors until you have set a new brush image!
|
|
</para>
|
|
</note>
|
|
<note><para>This function was added in PHP 4.0.6</para></note>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagesetstyle">
|
|
<refnamediv>
|
|
<refname>imagesetstyle</refname>
|
|
<refpurpose>Set the style for line drawing</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagesetstyle</methodname>
|
|
<methodparam><type>resource</type><parameter>im</parameter></methodparam>
|
|
<methodparam><type>array</type><parameter>style</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagesetstyle</function> sets the style to be used by all
|
|
line drawing functions (such as <function>imageline</function>
|
|
and <function>imagepolygon</function>) when drawing with the special
|
|
color <literal>IMG_COLOR_STYLED</literal> or lines of images with color
|
|
<literal>IMG_COLOR_STYLEDBRUSHED</literal>.
|
|
</para>
|
|
<para>
|
|
The <parameter>style</parameter> parameter is an array of pixels.
|
|
Following example script draws a dashed line from upper left to
|
|
lower right corner of the canvas:
|
|
<example>
|
|
<title>imagesetstyle</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
header ("Content-type: image/png");
|
|
$im = imagecreate (100, 100);
|
|
$w = imagecolorallocate ($im, 255, 255, 255);
|
|
$red = imagecolorallocate ($im, 255, 0, 0);
|
|
|
|
/* Draw a dashed line, 5 red pixels, 5 white pixels */
|
|
$style = array ($red,$red,$red,$red,$red,$w,$w,$w,$w,$w);
|
|
imagesetstyle ($im, $style);
|
|
imageline ($im, 0, 0, 100, 100, IMG_COLOR_STYLED);
|
|
|
|
/* Draw a line of happy faces using imagesetbrush() with imagesetstyle */
|
|
$style = array ($w,$w,$w,$w,$w,$w,$w,$w,$w,$w,$w,$w,$red);
|
|
imagesetstyle ($im, $style);
|
|
|
|
$brush = imagecreatefrompng ("http://www.libpng.org/pub/png/images/smile.happy.png");
|
|
imagecolortransparent ($brush, $w);
|
|
imagesetbrush ($im, $brush);
|
|
imageline ($im, 100, 0, 0, 100, IMG_COLOR_STYLEDBRUSHED);
|
|
|
|
imagepng ($im);
|
|
imagedestroy ($im);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
See also <function>imagesetbrush</function>, <function>imageline</function>.
|
|
</para>
|
|
<note><para>This function was added in PHP 4.0.6</para></note>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagesettile">
|
|
<refnamediv>
|
|
<refname>imagesettile</refname>
|
|
<refpurpose>Set the tile image for filling</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagesettile</methodname>
|
|
<methodparam><type>resource</type><parameter>im</parameter></methodparam>
|
|
<methodparam><type>resource</type><parameter>tile</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagesettile</function> sets the tile image to be
|
|
used by all region filling functions (such as <function>imagefill</function>
|
|
and <function>imagefilledpolygon</function>) when filling with the special
|
|
color <literal>IMG_COLOR_TILED</literal>.
|
|
</para>
|
|
<para>
|
|
A tile is an image used to fill an area with a repeated pattern. <emphasis>Any</emphasis>
|
|
GD image can be used as a tile, and by setting the transparent color index of the tile
|
|
image with <function>imagecolortransparent</function>, a tile allows certain parts
|
|
of the underlying area to shine through can be created.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
You need not take special action when you are finished with a tile, but if you
|
|
destroy the tile image, you must not use the <literal>IMG_COLOR_TILED</literal>
|
|
color until you have set a new tile image!
|
|
</para>
|
|
</note>
|
|
<note><para>This function was added in PHP 4.0.6</para></note>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagesetthickness">
|
|
<refnamediv>
|
|
<refname>imagesetthickness</refname>
|
|
<refpurpose>Set the thickness for line drawing</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>void</type><methodname>imagesetthickness</methodname>
|
|
<methodparam><type>resource</type><parameter>im</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>thickness</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagesetthickness</function> sets the thickness of the lines
|
|
drawn when drawing rectangles, polygons, ellipses etc. etc. to
|
|
<parameter>thickness</parameter> pixels.
|
|
</para>
|
|
<note><para>This function was added in PHP 4.0.6 and requires GD 2.0.1 or later</para></note>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagestring">
|
|
<refnamediv>
|
|
<refname>imagestring</refname>
|
|
<refpurpose>Draw a string horizontally</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagestring</methodname>
|
|
<methodparam><type>int</type><parameter>im</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>font</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>x</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>y</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>s</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>col</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagestring</function> draws the string
|
|
<parameter>s</parameter> in the image identified by
|
|
<parameter>im</parameter> at coordinates
|
|
<parameter>x</parameter>, <parameter>y</parameter> (top left is
|
|
0, 0) in color <parameter>col</parameter>. If font is 1, 2, 3, 4
|
|
or 5, a built-in font is used.
|
|
</para>
|
|
<para>
|
|
See also <function>imageloadfont</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagestringup">
|
|
<refnamediv>
|
|
<refname>imagestringup</refname>
|
|
<refpurpose>Draw a string vertically</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagestringup</methodname>
|
|
<methodparam><type>int</type><parameter>im</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>font</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>x</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>y</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>s</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>col</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagestringup</function> draws the string
|
|
<parameter>s</parameter> vertically in the image identified by
|
|
<parameter>im</parameter> at coordinates
|
|
<parameter>x</parameter>, <parameter>y</parameter> (top left is
|
|
0, 0) in color <parameter>col</parameter>. If font is 1, 2, 3, 4
|
|
or 5, a built-in font is used.
|
|
</para>
|
|
<para>
|
|
See also <function>imageloadfont</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagesx">
|
|
<refnamediv>
|
|
<refname>imagesx</refname>
|
|
<refpurpose>Get image width</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagesx</methodname>
|
|
<methodparam><type>int</type><parameter>im</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagesx</function> returns the width of the image
|
|
identified by <parameter>im</parameter>.
|
|
</para>
|
|
<para>
|
|
See also <function>imagecreate</function> and
|
|
<function>imagesy</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagesy">
|
|
<refnamediv>
|
|
<refname>imagesy</refname>
|
|
<refpurpose>Get image height</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagesy</methodname>
|
|
<methodparam><type>int</type><parameter>im</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagesy</function> returns the height of the image
|
|
identified by <parameter>im</parameter>.
|
|
</para>
|
|
<para>
|
|
See also <function>imagecreate</function> and
|
|
<function>imagesx</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagettfbbox">
|
|
<refnamediv>
|
|
<refname>imagettfbbox</refname>
|
|
<refpurpose>Give the bounding box of a text using TrueType fonts</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>imagettfbbox</methodname>
|
|
<methodparam><type>int</type><parameter>size</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>angle</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>fontfile</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>text</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
This function calculates and returns the bounding box in pixels
|
|
for a TrueType text.
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term>
|
|
<parameter>text</parameter>
|
|
</term>
|
|
<listitem>
|
|
<simpara>The string to be measured.</simpara>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term>
|
|
<parameter>size</parameter>
|
|
</term>
|
|
<listitem>
|
|
<simpara>The font size in pixels.</simpara>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term>
|
|
<parameter>fontfile</parameter>
|
|
</term>
|
|
<listitem>
|
|
<simpara>
|
|
The name of the TrueType font file. (Can also be an URL.) Depending on
|
|
which version of the GD library that PHP is using, it may attempt to
|
|
search for files that do not begin with a leading '/' by appending
|
|
'.ttf' to the filename and searching along a library-defined font path.
|
|
</simpara>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term>
|
|
<parameter>angle</parameter>
|
|
</term>
|
|
<listitem>
|
|
<simpara>
|
|
Angle in degrees in which <parameter>text</parameter> will be
|
|
measured.
|
|
</simpara>
|
|
</listitem>
|
|
</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>
|
|
<para>
|
|
This function requires both the GD library and the FreeType
|
|
library.
|
|
</para>
|
|
<para>
|
|
See also <function>imagettftext</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id='function.imageftbbox'>
|
|
<refnamediv>
|
|
<refname>imageftbbox</refname>
|
|
<refpurpose>Give the bounding box of a text using fonts via freetype2</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>imageftbbox</methodname>
|
|
<methodparam><type>int</type><parameter>size</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>angle</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>font_file</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>text</parameter></methodparam>
|
|
<methodparam choice="opt"><type>array</type><parameter>extrainfo</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
&warn.undocumented.func;
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagettftext">
|
|
<refnamediv>
|
|
<refname>imagettftext</refname>
|
|
<refpurpose>Write text to the image using TrueType fonts</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>imagettftext</methodname>
|
|
<methodparam><type>int</type><parameter>im</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>size</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>angle</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>x</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>y</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>col</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>fontfile</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>text</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagettftext</function> draws the string
|
|
<parameter>text</parameter> in the image identified by
|
|
<parameter>im</parameter>, starting at coordinates
|
|
<parameter>x</parameter>, <parameter>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>. Depending on which version of the GD
|
|
library that PHP is using, when <parameter>fontfile</parameter> does not
|
|
begin with a leading '/', '.ttf' will be appended to the filename and
|
|
the the library will attempt to search for that filename along a
|
|
library-defined font path.
|
|
</para>
|
|
<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>
|
|
<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>
|
|
<para>
|
|
<parameter>Fontfile</parameter> is the path to the TrueType font
|
|
you wish to use.
|
|
</para>
|
|
<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>
|
|
<para>
|
|
<parameter>Col</parameter> is the color index. Using the
|
|
negative of a color index has the effect of turning off
|
|
antialiasing.
|
|
</para>
|
|
<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 lower left, lower right, upper
|
|
right, upper 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>
|
|
<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 role="php">
|
|
<![CDATA[
|
|
<?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: Ω");
|
|
imagegif ($im);
|
|
imagedestroy ($im);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
This function requires both the GD library and the <ulink
|
|
url="&url.freetype;">FreeType</ulink> library.
|
|
</para>
|
|
<para>
|
|
See also <function>imagettfbbox</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id='function.imagefttext'>
|
|
<refnamediv>
|
|
<refname>imagefttext</refname>
|
|
<refpurpose>Write text to the image using fonts using FreeType 2</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>imagefttext</methodname>
|
|
<methodparam><type>int</type><parameter>im</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>size</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>angle</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>x</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>y</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>col</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>font_file</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>text</parameter></methodparam>
|
|
<methodparam choice="opt"><type>array</type><parameter>extrainfo</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
&warn.undocumented.func;
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.imagetypes">
|
|
<refnamediv>
|
|
<refname>imagetypes</refname>
|
|
<refpurpose>Return the image types supported by this PHP build</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>imagetypes</methodname>
|
|
<void/>
|
|
</methodsynopsis>
|
|
<para>
|
|
This function returns a bit-field corresponding to the image
|
|
formats supported by the version of GD linked into PHP. The
|
|
following bits are returned, <literal>IMG_GIF</literal> | <literal>IMG_JPG</literal>
|
|
| <literal>IMG_PNG</literal> | <literal>IMG_WBMP</literal>.
|
|
To check for PNG support, for example, do this:
|
|
<example>
|
|
<title>imagetypes</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
if (imagetypes() & IMG_PNG) {
|
|
echo "PNG Support is enabled";
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.jpeg2wbmp">
|
|
<refnamediv>
|
|
<refname>jpeg2wbmp</refname>
|
|
<refpurpose>Convert JPEG image file to WBMP image file</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>jpeg2wbmp</methodname>
|
|
<methodparam><type>string</type><parameter>jpegname</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>wbmpname</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>d_height</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>d_width</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>threshold</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Converts the <parameter>jpegname</parameter> JPEG file
|
|
to WBMP format, and saves it as <parameter>wbmpname</parameter>.
|
|
With the <parameter>d_height</parameter> and
|
|
<parameter>d_width</parameter> you specify the height
|
|
and width of the destination image.
|
|
</para>
|
|
<para>
|
|
<note>
|
|
<para>
|
|
WBMP support is only available if PHP was compiled
|
|
against GD-1.8 or later.
|
|
</para>
|
|
</note>
|
|
</para>
|
|
<para>
|
|
See also <function>png2wbmp</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.png2wbmp">
|
|
<refnamediv>
|
|
<refname>png2wbmp</refname>
|
|
<refpurpose>Convert PNG image file to WBMP image file</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>png2wbmp</methodname>
|
|
<methodparam><type>string</type><parameter>pngname</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>wbmpname</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>d_height</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>d_width</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>threshold</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Converts the <parameter>pngname</parameter> PNG file
|
|
to WBMP format, and saves it as <parameter>wbmpname</parameter>.
|
|
With the <parameter>d_height</parameter> and
|
|
<parameter>d_width</parameter> you specify the height
|
|
and width of the destination image.
|
|
</para>
|
|
<para>
|
|
<note>
|
|
<para>
|
|
WBMP support is only available if PHP was compiled
|
|
against GD-1.8 or later.
|
|
</para>
|
|
</note>
|
|
</para>
|
|
<para>
|
|
See also <function>jpeg2wbmp</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id='function.iptcembed'>
|
|
<refnamediv>
|
|
<refname>iptcembed</refname>
|
|
<refpurpose>Embed binary IPTC data into a JPEG image</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>iptcembed</methodname>
|
|
<methodparam><type>string</type><parameter>iptcdata</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>jpeg_file_name</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>spool</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
&warn.undocumented.func;
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.read-exif-data">
|
|
<refnamediv>
|
|
<refname>read_exif_data</refname>
|
|
<refpurpose>Reads header information stored in TIFF and JPEG images</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>exif_read_data</methodname>
|
|
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>sections</parameter></methodparam>
|
|
<methodparam><type>bool</type><parameter>arrays</parameter></methodparam>
|
|
<methodparam><type>bool</type><parameter>thumbnail</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<note>
|
|
<para>
|
|
The <function>read_exif_data</function> function is an
|
|
<link linkend="aliases">alias</link> for <function>exif_read_data</function>.
|
|
</para>
|
|
</note>
|
|
<para>
|
|
See also <function>exif_thumbnail</function>.
|
|
</para>
|
|
</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
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"../../manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|
|
|