mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 08:58:56 +00:00
Added new examples for gd documentation:
* imagecolorset * imagecreatefromgd * imagecreatefromgd2 * imagecreatefromxbm * imagecreatefromxpm * imagefttext * imagepalettecopy * imagepsencodefont * imagepsextendfont * imagepsslantfont * imagesetbrush * imagesetthickness * imagesettile Following examples are by Ross Masters: * imageantialias * imagecolorclosest * imagecolorclosestalpha * imagejpeg * imagewbmp * imagexbm git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@265298 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
39273a8e01
commit
3f9e7ba826
29 changed files with 857 additions and 58 deletions
BIN
reference/image/figures/imageantialias.png
Normal file
BIN
reference/image/figures/imageantialias.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
BIN
reference/image/figures/imagefilltoborder.png
Normal file
BIN
reference/image/figures/imagefilltoborder.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 530 B |
BIN
reference/image/figures/imagejpeg.jpg
Normal file
BIN
reference/image/figures/imagejpeg.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 287 B |
BIN
reference/image/figures/imagesetbrush.png
Normal file
BIN
reference/image/figures/imagesetbrush.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
BIN
reference/image/figures/imagesetthickness.png
Normal file
BIN
reference/image/figures/imagesetthickness.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 377 B |
BIN
reference/image/figures/imagesettile.png
Normal file
BIN
reference/image/figures/imagesettile.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.11 $ -->
|
||||
<!-- $Revision: 1.12 $ -->
|
||||
<refentry xml:id="function.imageantialias" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>imageantialias</refname>
|
||||
|
@ -10,7 +10,7 @@
|
|||
<methodsynopsis>
|
||||
<type>bool</type><methodname>imageantialias</methodname>
|
||||
<methodparam><type>resource</type><parameter>image</parameter></methodparam>
|
||||
<methodparam><type>bool</type><parameter>on</parameter></methodparam>
|
||||
<methodparam><type>bool</type><parameter>enabled</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Activate the fast drawing antialiased methods for lines and wired polygons.
|
||||
|
@ -33,7 +33,7 @@
|
|||
<variablelist>
|
||||
&gd.image.description;
|
||||
<varlistentry>
|
||||
<term><parameter>on</parameter></term>
|
||||
<term><parameter>enabled</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Whether to enable antialiasing or not.
|
||||
|
@ -49,6 +49,50 @@
|
|||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>A comparison of two lines, one with anti-aliasing switched on</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// Setup an anti-aliased image and a normal image
|
||||
$aa = imagecreatetruecolor(400, 100);
|
||||
$normal = imagecreatetruecolor(200, 100);
|
||||
|
||||
// Switch antialiasing on for one image
|
||||
imageantialias($aa, true);
|
||||
|
||||
// Allocate colors
|
||||
$red = imagecolorallocate($normal, 255, 0, 0);
|
||||
$red_aa = imagecolorallocate($aa, 255, 0, 0);
|
||||
|
||||
// Draw two lines, one with AA enabled
|
||||
imageline($normal, 0, 0, 200, 100, $red);
|
||||
imageline($aa, 0, 0, 200, 100, $red_aa);
|
||||
|
||||
// Merge the two images side by side for output (AA: left, Normal: Right)
|
||||
imagecopymerge($aa, $normal, 200, 0, 0, 0, 200, 100, 100);
|
||||
|
||||
// Output image
|
||||
header('Content-type: image/png');
|
||||
|
||||
imagepng($aa);
|
||||
imagedestroy($aa);
|
||||
imagedestroy($normal);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<mediaobject>
|
||||
<imageobject>
|
||||
<imagedata fileref="figures/image.imageantialias.png"/>
|
||||
</imageobject>
|
||||
</mediaobject>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
¬e.bundled.gd;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<refentry xml:id="function.imagecolorclosest" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>imagecolorclosest</refname>
|
||||
|
@ -69,11 +69,60 @@
|
|||
the specified one
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>Search for a set of colors in an image</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// Start with an image and convert it to a palette-based image
|
||||
$im = imagecreatefrompng('figures/imagecolorclosest.png');
|
||||
imagetruecolortopalette($im, false, 255);
|
||||
|
||||
// Search colors (RGB)
|
||||
$colors = array(
|
||||
array(254, 145, 154),
|
||||
array(153, 145, 188),
|
||||
array(153, 90, 145),
|
||||
array(255, 137, 92)
|
||||
);
|
||||
|
||||
// Loop through each search and find the closest color in the palette.
|
||||
// Return the search number, the search RGB and the converted RGB match
|
||||
foreach($colors as $id => $rgb)
|
||||
{
|
||||
$result = imagecolorclosest($im, $rgb[0], $rgb[1], $rgb[2]);
|
||||
$result = imagecolorsforindex($im, $result);
|
||||
$result = "({$result['red']}, {$result['green']}, {$result['blue']})";
|
||||
|
||||
echo "#$id: Search ($rgb[0], $rgb[1], $rgb[2]); Closest match: $result.\n";
|
||||
}
|
||||
|
||||
imagedestroy($im);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
#0: Search (254, 145, 154); Closest match: (252, 150, 148).
|
||||
#1: Search (153, 145, 188); Closest match: (148, 150, 196).
|
||||
#2: Search (153, 90, 145); Closest match: (148, 90, 156).
|
||||
#3: Search (255, 137, 92); Closest match: (252, 150, 92).
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>imagecolorexact</function></member>
|
||||
<member><function>imagecolorclosestalpha</function></member>
|
||||
<member><function>imagecolorclosesthwb</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<refentry xml:id="function.imagecolorclosestalpha" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>imagecolorclosestalpha</refname>
|
||||
|
@ -71,6 +71,53 @@
|
|||
Returns the index of the closest color in the palette.
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>Search for a set of colors in an image</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// Start with an image and convert it to a palette-based image
|
||||
$im = imagecreatefrompng('figures/imagecolorclosest.png');
|
||||
imagetruecolortopalette($im, false, 255);
|
||||
|
||||
// Search colors (RGB)
|
||||
$colors = array(
|
||||
array(254, 145, 154, 50),
|
||||
array(153, 145, 188, 127),
|
||||
array(153, 90, 145, 0),
|
||||
array(255, 137, 92, 84)
|
||||
);
|
||||
|
||||
// Loop through each search and find the closest color in the palette.
|
||||
// Return the search number, the search RGB and the converted RGB match
|
||||
foreach($colors as $id => $rgb)
|
||||
{
|
||||
$result = imagecolorclosestalpha($im, $rgb[0], $rgb[1], $rgb[2], $rgb[3]);
|
||||
$result = imagecolorsforindex($im, $result);
|
||||
$result = "({$result['red']}, {$result['green']}, {$result['blue']}, {$result['alpha']})";
|
||||
|
||||
echo "#$id: Search ($rgb[0], $rgb[1], $rgb[2], $rgb[3]); Closest match: $result.\n";
|
||||
}
|
||||
|
||||
imagedestroy($im);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
#0: Search (254, 145, 154, 50); Closest match: (252, 150, 148, 0).
|
||||
#1: Search (153, 145, 188, 127); Closest match: (148, 150, 196, 0).
|
||||
#2: Search (153, 90, 145, 0); Closest match: (148, 90, 156, 0).
|
||||
#3: Search (255, 137, 92, 84); Closest match: (252, 150, 92, 0).
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
¬e.gd.2;
|
||||
|
@ -80,6 +127,8 @@
|
|||
<para>
|
||||
<simplelist>
|
||||
<member><function>imagecolorexactalpha</function></member>
|
||||
<member><function>imagecolorclosest</function></member>
|
||||
<member><function>imagecolorclosesthwb</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<refentry xml:id='function.imagecolorclosesthwb' xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>imagecolorclosesthwb</refname>
|
||||
<refpurpose>Get the index of the color which has the hue, white and blackness</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
|
@ -20,7 +19,6 @@
|
|||
white and blacknessnearest the given color.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
|
@ -53,7 +51,6 @@
|
|||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
|
@ -61,31 +58,6 @@
|
|||
the hue, white and blackness nearest the given color.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="changelog">
|
||||
&reftitle.changelog;
|
||||
<para>
|
||||
<informaltable>
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>&Version;</entry>
|
||||
<entry>&Description;</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>5.3.0</entry>
|
||||
<entry>
|
||||
This function is now available on Windows
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
|
@ -111,7 +83,38 @@ HWB: 33
|
|||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="changelog">
|
||||
&reftitle.changelog;
|
||||
<para>
|
||||
<informaltable>
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>&Version;</entry>
|
||||
<entry>&Description;</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>5.3.0</entry>
|
||||
<entry>
|
||||
This function is now available on Windows
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>imagecolorclosest</function></member>
|
||||
<member><function>imagecolorclosesthwb</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<refentry xml:id="function.imagecolorset" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>imagecolorset</refname>
|
||||
|
@ -68,6 +68,37 @@
|
|||
&return.void;
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>imagecolorset/function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// Create a 300x100 image
|
||||
$im = imagecreate(300, 100);
|
||||
|
||||
// Set the background to be red
|
||||
imagecolorallocate($im, 255, 0, 0);
|
||||
|
||||
// Get the color index for the background
|
||||
$bg = imagecolorat($im, 0, 0);
|
||||
|
||||
// Set the backgrund to be blue
|
||||
imagecolorset($im, $bg, 0, 0, 255);
|
||||
|
||||
// Output the image to the browser
|
||||
//header('Content-type: image/png');
|
||||
|
||||
imagepng($im);
|
||||
imagedestroy($im);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<refentry xml:id='function.imagecreatefromgd' xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>imagecreatefromgd</refname>
|
||||
|
@ -37,6 +37,34 @@
|
|||
Returns an image resource identifier on success, &false; on errors.
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>imagecreatefromgd</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// Load the gd image
|
||||
$im = @imagecreatefromgd('./test.gd');
|
||||
|
||||
// Test if the image was loaded
|
||||
if(!is_resource($im))
|
||||
{
|
||||
die('Unable to load gd image!');
|
||||
}
|
||||
|
||||
// Do image operations here
|
||||
|
||||
// Save the image
|
||||
imagegd($im, './test_updated.gd');
|
||||
imagedestroy($im);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
&warn.no-win32-fopen-wrapper;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<!-- $Revision: 1.11 $ -->
|
||||
<refentry xml:id='function.imagecreatefromgd2' xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>imagecreatefromgd2</refname>
|
||||
|
@ -37,6 +37,33 @@
|
|||
Returns an image resource identifier on success, &false; on errors.
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>imagecreatefromgd2</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// Load the gd2 image
|
||||
$im = imagecreatefromgd2('./test.gd2');
|
||||
|
||||
// Apply an effect on the image, in this
|
||||
// case negate the image if PHP5+
|
||||
if(function_exists('imagefilter'))
|
||||
{
|
||||
imagefilter($im, IMG_FILTER_NEGATE);
|
||||
}
|
||||
|
||||
// Save the image
|
||||
imagegd2($im, './test_updated.gd2');
|
||||
imagedestroy($im);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
¬e.gd.2;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<refentry xml:id="function.imagecreatefromxbm" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>imagecreatefromxbm</refname>
|
||||
|
@ -39,6 +39,26 @@
|
|||
Returns an image resource identifier on success, &false; on errors.
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>Convert an XBM image to a png image using <function>imagecreatefromxbm</function></title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// Load the xbm file
|
||||
$xbm = imagecreatefromxbm('./example.xbm');
|
||||
|
||||
// Convert it to a png file
|
||||
imagepng($xbm, './example.png');
|
||||
imagedestroy($xbm);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.11 $ -->
|
||||
<!-- $Revision: 1.12 $ -->
|
||||
<refentry xml:id="function.imagecreatefromxpm" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>imagecreatefromxpm</refname>
|
||||
|
@ -38,7 +38,37 @@
|
|||
Returns an image resource identifier on success, &false; on errors.
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="returnvalues">
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>Creating an image instance using <function>imagecreatefromxpm</function></title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// Check for XPM support
|
||||
if(!(imagetypes() & IMG_XPM))
|
||||
{
|
||||
die('Support for xpm was not found!');
|
||||
}
|
||||
|
||||
// Create the image instance
|
||||
$xpm = imagecreatefromxpm('./example.xpm');
|
||||
|
||||
// Do image operations here
|
||||
|
||||
// PHP has no support for writing xpm images
|
||||
// so in this case we save the image as a
|
||||
// jpeg file with 100% quality
|
||||
imagejpeg($im, './example.jpg', 100);
|
||||
imagedestroy($im);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="notes">
|
||||
&reftitle.returnvalues;
|
||||
¬e.bundled.gd;
|
||||
¬e.no-windows;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.15 $ -->
|
||||
<!-- $Revision: 1.16 $ -->
|
||||
<refentry xml:id="function.imagecreatetruecolor" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>imagecreatetruecolor</refname>
|
||||
|
@ -64,11 +64,11 @@
|
|||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
header ("Content-type: image/png");
|
||||
header ('Content-type: image/png');
|
||||
$im = @imagecreatetruecolor(120, 20)
|
||||
or die("Cannot Initialize new GD image stream");
|
||||
or die('Cannot Initialize new GD image stream');
|
||||
$text_color = imagecolorallocate($im, 233, 14, 91);
|
||||
imagestring($im, 1, 5, 5, "A Simple Text String", $text_color);
|
||||
imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);
|
||||
imagepng($im);
|
||||
imagedestroy($im);
|
||||
?>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<refentry xml:id="function.imagefilltoborder" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>imagefilltoborder</refname>
|
||||
|
@ -71,6 +71,44 @@
|
|||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>Filling an ellipse with a color</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// Create the image handle, set the background to white
|
||||
$im = imagecreatetruecolor(100, 100);
|
||||
imagefilledrectangle($im, 0, 0, 100, 100, imagecolorallocate($im, 255, 255, 255));
|
||||
|
||||
// Draw an ellipse to fill with a black border
|
||||
imageellipse($im, 50, 50, 50, 50, imagecolorallocate($im, 0, 0, 0));
|
||||
|
||||
// Set the border and fill colors
|
||||
$border = imagecolorallocate($im, 0, 0, 0);
|
||||
$fill = imagecolorallocate($im, 255, 0, 0);
|
||||
|
||||
// Fill the selection
|
||||
imagefilltoborder($im, 50, 50, $border, $fill);
|
||||
|
||||
// Output and free memory
|
||||
header('Content-type: image/png');
|
||||
imagepng($im);
|
||||
imagedestroy($im);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<mediaobject>
|
||||
<imageobject>
|
||||
<imagedata fileref="figures/image.imagefilltoborder.png" />
|
||||
</imageobject>
|
||||
</mediaobject>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.16 $ -->
|
||||
<!-- $Revision: 1.17 $ -->
|
||||
<refentry xml:id='function.imagefttext' xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>imagefttext</refname>
|
||||
|
@ -192,6 +192,39 @@ $font = 'SomeFont';
|
|||
</informaltable>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>imagefttext</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// Create a 300x100 image
|
||||
$im = imagecreatetruecolor(300, 100);
|
||||
$red = imagecolorallocate($im, 0xFF, 0x00, 0x00);
|
||||
$black = imagecolorallocate($im, 0x00, 0x00, 0x00);
|
||||
|
||||
// Make the background red
|
||||
imagefilledrectangle($im, 0, 0, 299, 99, $red);
|
||||
|
||||
// Path to our ttf font file
|
||||
$font_file = './arial.ttf';
|
||||
|
||||
// Draw the text 'PHP Manual' using font size 13
|
||||
imagefttext($im, 13, 0, 105, 55, $black, $font_file, 'PHP Manual');
|
||||
|
||||
// Output image to the browser
|
||||
header('Content-Type: image/png');
|
||||
|
||||
imagepng($im);
|
||||
imagedestroy($im);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
¬e.gd.2;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.11 $ -->
|
||||
<!-- $Revision: 1.12 $ -->
|
||||
<refentry xml:id="function.imagejpeg" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>imagejpeg</refname>
|
||||
|
@ -55,6 +55,84 @@
|
|||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>Outputting a JPEG image</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// Create a blank image and add some text
|
||||
$im = imagecreatetruecolor(120, 20);
|
||||
$text_color = imagecolorallocate($im, 233, 14, 91);
|
||||
imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);
|
||||
|
||||
// Set the content type header - in this case image/jpeg
|
||||
header('Content-type: image/jpeg');
|
||||
|
||||
// Output the image
|
||||
imagejpeg($im);
|
||||
|
||||
// Free up memory
|
||||
imagedestroy($im);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<mediaobject>
|
||||
<imageobject>
|
||||
<imagedata fileref="figures/image.imagejpeg.jpg"/>
|
||||
</imageobject>
|
||||
</mediaobject>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>Saving a JPEG image</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// Create a blank image and add some text
|
||||
$im = imagecreatetruecolor(120, 20);
|
||||
$text_color = imagecolorallocate($im, 233, 14, 91);
|
||||
imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);
|
||||
|
||||
// Save the image as 'simpletext.jpg'
|
||||
imagejpeg($im, 'simpletext.jpg');
|
||||
|
||||
// Free up memory
|
||||
imagedestroy($im);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>Outputting the image at 75% quality</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// Create a blank image and add some text
|
||||
$im = imagecreatetruecolor(120, 20);
|
||||
$text_color = imagecolorallocate($im, 233, 14, 91);
|
||||
imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);
|
||||
|
||||
// Set the content type header - in this case image/jpeg
|
||||
header('Content-type: image/jpeg');
|
||||
|
||||
// Skip the filename parameter using NULL, then set the quality to 75%
|
||||
imagejpeg($im, NULL, 75);
|
||||
|
||||
// Free up memory
|
||||
imagedestroy($im);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
¬e.config.jpeg;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<refentry xml:id="function.imagepalettecopy" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>imagepalettecopy</refname>
|
||||
|
@ -47,6 +47,42 @@
|
|||
&return.void;
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>imagepalettecopy</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// Create two palette images
|
||||
$palette1 = imagecreate(100, 100);
|
||||
$palette2 = imagecreate(100, 100);
|
||||
|
||||
// Allocate the background to be
|
||||
// green in the first palette image
|
||||
$green = imagecolorallocate($palette1, 0, 255, 0);
|
||||
|
||||
// Copy the palette from image 1 to image 2
|
||||
imagepalettecopy($palette2, $palette1);
|
||||
|
||||
// Since the palette is now copied we can use the
|
||||
// green color allocated to image 1 without using
|
||||
// imagecolorallocate() twice
|
||||
imagefilledrectangle($palette2, 0, 0, 99, 99, $green);
|
||||
|
||||
// Output image to the browser
|
||||
header('Content-type: image/png');
|
||||
|
||||
imagepng($palette2);
|
||||
imagedestroy($palette1);
|
||||
imagedestroy($palette2);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.12 $ -->
|
||||
<!-- $Revision: 1.13 $ -->
|
||||
<refentry xml:id="function.imagepsencodefont" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>imagepsencodefont</refname>
|
||||
|
@ -58,6 +58,30 @@
|
|||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>imagepsencodefont</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// Load a .pfb font file
|
||||
$font = imagepsloadfont('./px3l.pfb');
|
||||
|
||||
// Tell T1lib to use ISO Latin 1 encoding
|
||||
imagepsencode($font, './IsoLatin1.enc');
|
||||
|
||||
// Do any operations with the font here
|
||||
|
||||
// Free the font from memory
|
||||
imagepsfreefont($font);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
¬e.config.t1lib;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<refentry xml:id="function.imagepsextendfont" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>imagepsextendfont</refname>
|
||||
|
@ -47,6 +47,30 @@
|
|||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>imagepsextendfont</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// Load a .pfb font file
|
||||
$font = imagepsloadfont('./px3l.pfb');
|
||||
|
||||
// Extend the font by 2.5
|
||||
imagepsextendfont($font, 2.5);
|
||||
|
||||
// Do any operations with the font here
|
||||
|
||||
// Free the font from memory
|
||||
imagepsfreefont($font);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
¬e.config.t1lib;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<!-- $Revision: 1.11 $ -->
|
||||
<refentry xml:id="function.imagepsslantfont" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>imagepsslantfont</refname>
|
||||
|
@ -45,6 +45,30 @@
|
|||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>imagepsslantfont</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// Load a .pfb font file
|
||||
$font = imagepsloadfont('./px3l.pfb');
|
||||
|
||||
// Slant the font by 22.5
|
||||
imagepsslantfont($font, 22.5);
|
||||
|
||||
// Do any operations with the font here
|
||||
|
||||
// Free the font from memory
|
||||
imagepsfreefont($font);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
¬e.config.t1lib;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<refentry xml:id="function.imagesetbrush" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>imagesetbrush</refname>
|
||||
|
@ -42,6 +42,48 @@
|
|||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>Saving an XBM file</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// Load a mini php logo
|
||||
$php = imagecreatefrompng('./php.png');
|
||||
|
||||
// Create the main image, 100x100
|
||||
$im = imagecreatetruecolor(100, 100);
|
||||
|
||||
// Fill the background with white
|
||||
$white = imagecolorallocate($im, 255, 255, 255);
|
||||
imagefilledrectangle($im, 0, 0, 299, 99, $white);
|
||||
|
||||
// Set the brush
|
||||
imagesetbrush($im, $php);
|
||||
|
||||
// Draw a couple of brushes, each overlaying each
|
||||
imageline($im, 50, 50, 50, 60, IMG_COLOR_BRUSHED);
|
||||
|
||||
// Output image to the browser
|
||||
header('Content-type: image/png');
|
||||
|
||||
imagepng($im);
|
||||
imagedestroy($im);
|
||||
imagedestroy($php);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<mediaobject>
|
||||
<imageobject>
|
||||
<imagedata fileref="figures/image.imagesetbrush.png"/>
|
||||
</imageobject>
|
||||
</mediaobject>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
<note>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<!-- $Revision: 1.11 $ -->
|
||||
<refentry xml:id="function.imagesetthickness" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>imagesetthickness</refname>
|
||||
|
@ -40,6 +40,45 @@
|
|||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>Saving an XBM file</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// Create a 200x100 image
|
||||
$im = imagecreatetruecolor(200, 100);
|
||||
$white = imagecolorallocate($im, 0xFF, 0xFF, 0xFF);
|
||||
$black = imagecolorallocate($im, 0x00, 0x00, 0x00);
|
||||
|
||||
// Set the background to be white
|
||||
imagefilledrectangle($im, 0, 0, 299, 99, $white);
|
||||
|
||||
// Set the line thickness to 5
|
||||
imagesetthickness($im, 5);
|
||||
|
||||
// Draw the rectangle
|
||||
imagerectangle($im, 14, 14, 185, 85, $black);
|
||||
|
||||
// Output image to the browser
|
||||
header('Content-Type: image/png');
|
||||
|
||||
imagepng($im);
|
||||
imagedestroy($im);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<mediaobject>
|
||||
<imageobject>
|
||||
<imagedata fileref="figures/image.imagesetthickness.png"/>
|
||||
</imageobject>
|
||||
</mediaobject>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
¬e.gd.2;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<!-- $Revision: 1.11 $ -->
|
||||
<refentry xml:id="function.imagesettile" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>imagesettile</refname>
|
||||
|
@ -54,6 +54,43 @@
|
|||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>Saving an XBM file</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// Load an external image
|
||||
$zend = imagecreatefromgif('./zend.gif');
|
||||
|
||||
// Create a 200x200 image
|
||||
$im = imagecreatetruecolor(200, 200);
|
||||
|
||||
// Set the tile
|
||||
imagesettile($im, $zend);
|
||||
|
||||
// Make the image repeat
|
||||
imagefilledrectangle($im, 0, 0, 199, 199, IMG_COLOR_TILED);
|
||||
|
||||
// Output image to the browser
|
||||
header('Content-Type: image/png');
|
||||
|
||||
imagepng($im);
|
||||
imagedestroy($im);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<mediaobject>
|
||||
<imageobject>
|
||||
<imagedata fileref="figures/image.imagesettile.png"/>
|
||||
</imageobject>
|
||||
</mediaobject>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<refentry xml:id="function.imagetruecolortopalette" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>imagetruecolortopalette</refname>
|
||||
|
@ -56,6 +56,29 @@
|
|||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>Converting a true color image to a palette-based image</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// Create a new true color image
|
||||
$im = new imagecreatetruecolor(100, 100);
|
||||
|
||||
// Convert to palette-based with no dithering and 255 colors
|
||||
imagetruecolortopalette($im, false, 255);
|
||||
|
||||
// Save the image
|
||||
imagepng($im, './paletteimage.png');
|
||||
imagedestroy($im);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
¬e.gd.2;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<!-- $Revision: 1.11 $ -->
|
||||
<refentry xml:id="function.imagewbmp" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>imagewbmp</refname>
|
||||
|
@ -51,6 +51,78 @@
|
|||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>Outputting a WBMP image</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// Create a blank image and add some text
|
||||
$im = imagecreatetruecolor(120, 20);
|
||||
$text_color = imagecolorallocate($im, 233, 14, 91);
|
||||
imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);
|
||||
|
||||
// Set the content type header - in this case image/vnd.wap.wbmp
|
||||
// Hint: see image_type_to_mime_type() for content-types
|
||||
header('Content-type: image/vnd.wap.wbmp');
|
||||
|
||||
// Output the image
|
||||
imagewbmp($im);
|
||||
|
||||
// Free up memory
|
||||
imagedestroy($im);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>Saving the WBMP image</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
// Create a blank image and add some text
|
||||
$im = imagecreatetruecolor(120, 20);
|
||||
$text_color = imagecolorallocate($im, 233, 14, 91);
|
||||
imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);
|
||||
|
||||
// Save the image
|
||||
imagewbmp($im, 'simpletext.wbmp');
|
||||
|
||||
// Free up memory
|
||||
imagedestroy($im);
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>Outputting the image with a different foreground</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
// Create a blank image and add some text
|
||||
$im = imagecreatetruecolor(120, 20);
|
||||
$text_color = imagecolorallocate($im, 233, 14, 91);
|
||||
imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);
|
||||
|
||||
// Set the content type header - in this case image/vnd.wap.wbmp
|
||||
// Hint: see image_type_to_mime_type() for content-types
|
||||
header('Content-type: image/vnd.wap.wbmp');
|
||||
|
||||
// Set a replacement foreground color
|
||||
$foreground_color = imagecolorallocate($im, 255, 0, 0);
|
||||
|
||||
imagewbmp($im, NULL, $foreground_color);
|
||||
|
||||
// Free up memory
|
||||
imagedestroy($im);
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
<note>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<refentry xml:id="function.imagexbm" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>imagexbm</refname>
|
||||
|
@ -51,6 +51,54 @@
|
|||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>Saving an XBM file</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// Create a blank image and add some text
|
||||
$im = imagecreatetruecolor(120, 20);
|
||||
$text_color = imagecolorallocate($im, 233, 14, 91);
|
||||
imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);
|
||||
|
||||
// Save the image
|
||||
imagexbm($im, 'simpletext.xbm');
|
||||
|
||||
// Free up memory
|
||||
imagedestroy($im);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>Saving an XBM file with a different foreground color</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// Create a blank image and add some text
|
||||
$im = imagecreatetruecolor(120, 20);
|
||||
$text_color = imagecolorallocate($im, 233, 14, 91);
|
||||
imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);
|
||||
|
||||
// Set a replacement foreground color
|
||||
$foreground_color = imagecolorallocate($im, 255, 0, 0);
|
||||
|
||||
// Save the image
|
||||
imagexbm($im, NULL, $foreground_color);
|
||||
|
||||
// Free up memory
|
||||
imagedestroy($im);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
¬e.bundled.gd;
|
||||
|
|
Loading…
Reference in a new issue