integrating users notes

adding examples
obfuscating vic's email
adding documentation to image_type_to_mime_type


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@137914 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Mehdi Achour 2003-08-15 22:50:50 +00:00
parent 42a2d70b78
commit 38754fb943
17 changed files with 367 additions and 46 deletions

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.8 $ -->
<!-- $Revision: 1.9 $ -->
<!-- splitted from ./en/functions/image.xml, last change in rev 1.78 -->
<refentry id="function.exif-read-data">
<refnamediv>
@ -90,6 +90,11 @@
idea of how to actually tag their images, so you can't always rely on
a specific Exif header being present.
</para>
<para>
Windows ME/XP both can wipe the Exif headers when connecting to a camera.
More information available at <ulink
url="&url.winexif;">&url.winexif;</ulink>.
</para>
</note>
<para>
<example>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
<!-- $Revision: 1.4 $ -->
<refentry id='function.gd-info'>
<refnamediv>
<refname>gd_info</refname>
@ -92,10 +92,14 @@
<![CDATA[
<?php
var_dump(gd_info());
/* Typical Output
==============
?>
]]>
</programlisting>
<para>
The typical output is :
</para>
<screen>
<![CDATA[
array(9) {
["GD Version"]=>
string(24) "bundled (2.0 compatible)"
@ -116,15 +120,12 @@ array(9) {
["XBM Support"]=>
bool(false)
}
*/
?>
]]>
</programlisting>
</screen>
</example>
</para>
<simpara>
See also: <function>imagepng</function>,
See also <function>imagepng</function>,
<function>imagejpeg</function>,
<function>imagegif</function>,
<function>imagewbmp</function>, and

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.18 $ -->
<!-- $Revision: 1.19 $ -->
<!-- splitted from ./en/functions/image.xml, last change in rev 1.36 -->
<refentry id="function.getimagesize">
<refnamediv>
@ -62,7 +62,11 @@ echo "<img src=\"img/flag.jpg\" $attr>";
<programlisting role="php">
<![CDATA[
<?php
$size = getimagesize ("http://www.example.com/gifs/logo.gif");
$size = getimagesize("http://www.example.com/gifs/logo.gif");
// if the file name has space in it, encode it properly
$size = getimagesize("http://www.example.com/gifs/lo%20go.gif");
?>
]]>
</programlisting>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<!-- $Revision: 1.2 $ -->
<!-- splitted from ./en/functions/image.xml, last change in rev 1.36 -->
<refentry id="function.image-type-to-mime-type">
<refnamediv>
@ -27,18 +27,101 @@ header ("Content-type: ".image_type_to_mime_type (IMAGETYPE_PNG));
</programlisting>
</example>
</para>
<para>
The returned values are as follows
<table>
<title>Returned values Constants</title>
<tgroup cols="2">
<thead>
<row>
<entry><parameter>imagetype</parameter></entry>
<entry>Returned value</entry>
</row>
</thead>
<tbody>
<row>
<entry><constant>IMAGETYPE_GIF</constant></entry>
<entry><literal>image/gif</literal></entry>
</row>
<row>
<entry><constant>IMAGETYPE_JPEG</constant></entry>
<entry><literal>image/jpeg</literal></entry>
</row>
<row>
<entry><constant>IMAGETYPE_PNG</constant></entry>
<entry><literal>image/png</literal></entry>
</row>
<row>
<entry><constant>IMAGETYPE_SWF</constant></entry>
<entry><literal>application/x-shockwave-flash</literal></entry>
</row>
<row>
<entry><constant>IMAGETYPE_PSD</constant></entry>
<entry><literal>image/psd</literal></entry>
</row>
<row>
<entry><constant>IMAGETYPE_BMP</constant></entry>
<entry><literal>image/bmp</literal></entry>
</row>
<row>
<entry><constant>IMAGETYPE_TIFF_II</constant> (intel byte order)</entry>
<entry><literal>image/tiff</literal></entry>
</row>
<row>
<entry>
<constant>IMAGETYPE_TIFF_MM</constant> (motorola byte order)
</entry>
<entry><literal>image/tiff</literal></entry>
</row>
<row>
<entry><constant>IMAGETYPE_JPC</constant></entry>
<entry><literal>application/octet-stream</literal></entry>
</row>
<row>
<entry><constant>IMAGETYPE_JP2</constant></entry>
<entry><literal>image/jp2</literal></entry>
</row>
<row>
<entry><constant>IMAGETYPE_JPX</constant></entry>
<entry><literal>application/octet-stream</literal></entry>
</row>
<row>
<entry><constant>IMAGETYPE_JB2</constant></entry>
<entry><literal>application/octet-stream</literal></entry>
</row>
<row>
<entry><constant>IMAGETYPE_SWC</constant></entry>
<entry><literal>application/x-shockwave-flash</literal></entry>
</row>
<row>
<entry><constant>IMAGETYPE_IFF</constant></entry>
<entry><literal>image/iff</literal></entry>
</row>
<row>
<entry><constant>IMAGETYPE_WBMP</constant></entry>
<entry><literal>image/vnd.wap.wbmp</literal></entry>
</row>
<row>
<entry><constant>IMAGETYPE_XBM</constant></entry>
<entry><literal>image/xbm</literal></entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
<note>
<simpara>
This function does not require the GD image library.
</simpara>
<simpara>
See also <function>getimagesize</function>,
<function>exif_imagetype</function>, <function>exif_read_data</function>
and <function>exif_thumbnail</function>.
</simpara>
</note>
</para>
<para>
See also <function>getimagesize</function>,
<function>exif_imagetype</function>,
<function>exif_read_data</function> and
<function>exif_thumbnail</function>.
</para>
</refsect1>
</refentry>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
<!-- $Revision: 1.4 $ -->
<!-- splitted from ./en/functions/image.xml, last change in rev 1.61 -->
<refentry id="function.image2wbmp">
<refnamediv>
@ -27,6 +27,23 @@
using <function>header</function>, you can create
a PHP script that outputs WBMP images directly.
</para>
<para>
<example>
<title><function>image2wbmp</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$file = 'php.jpg';
header('Content-type: ' . image_type_to_mime(IMAGETYPE_WBMP));
image2wbmp($file); // output the stream directly
?>
]]>
</programlisting>
</example>
</para>
<note>
<para>
WBMP support is only available if PHP was compiled

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- $Revision: 1.5 $ -->
<!-- splitted from ./en/functions/image.xml, last change in rev 1.36 -->
<refentry id="function.imagechar">
<refnamediv>
@ -27,7 +27,33 @@
corresponding to larger fonts).
</para>
<para>
See also <function>imageloadfont</function>.
<example>
<title><function>imagechar</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$im = imagecreate(100,100);
$string = 'PHP';
$bg = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
// prints a black "P" in the top left corner
imagechar($im, 1, 0, 0, $string, $black);
header('Content-type: image/png');
imagepng($im);
?>
]]>
</programlisting>
</example>
</para>
<para>
See also <function>imagecharup</function> and
<function>imageloadfont</function>.
</para>
</refsect1>
</refentry>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- $Revision: 1.5 $ -->
<!-- splitted from ./en/functions/image.xml, last change in rev 1.36 -->
<refentry id="function.imagecharup">
<refnamediv>
@ -27,7 +27,33 @@
used.
</para>
<para>
See also <function>imageloadfont</function>.
<example>
<title><function>imagecharup</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$im = imagecreate(100,100);
$string = 'Note that the first letter is a N';
$bg = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
// prints a black "Z" on a white background
imagecharup($im, 3, 10, 10, $string, $black);
header('Content-type: image/png');
imagepng($im);
?>
]]>
</programlisting>
</example>
</para>
<para>
See also <function>imagechar</function> and
<function>imageloadfont</function>.
</para>
</refsect1>
</refentry>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.5 $ -->
<!-- $Revision: 1.6 $ -->
<!-- splitted from ./en/functions/image.xml, last change in rev 1.36 -->
<refentry id="function.imagecolorallocate">
<refnamediv>
@ -23,16 +23,34 @@
function. <parameter>red</parameter>, <parameter>green</parameter> and
<parameter>blue</parameter> are the values of the red, green and blue
component of the requested color respectively. These parameters are
integers between 0 and 255.
integers between 0 and 255 or hexadecimals between 0x00 and 0xFF.
<function>imagecolorallocate</function> must be called
to create each color that is to be used in the image represented
by <parameter>image</parameter>.
</para>
<note>
<para>
The first call to <function>imagecolorallocate</function> fills
the background color.
</para>
</note>
<para>
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
$white = imagecolorallocate ($im, 255, 255, 255);
$black = imagecolorallocate ($im, 0, 0, 0);
// sets background to red
$background = imagecolorallocate($im, 255, 0, 0);
// sets some colors
$white = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
// hexadecimal way
$white = imagecolorallocate($im, 0xFF, 0xFF, 0xFF);
$black = imagecolorallocate($im, 0x00, 0x00, 0x00);
?>
]]>
</programlisting>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
<!-- $Revision: 1.4 $ -->
<!-- splitted from ./en/functions/image.xml, last change in rev 1.36 -->
<refentry id="function.imagecolorclosestalpha">
<refnamediv>
@ -20,10 +20,14 @@
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>
<note>
<para>
This function was added in PHP 4.0.6 and requires GD 2.0.1
</para>
</note>
<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>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
<!-- $Revision: 1.4 $ -->
<!-- splitted from ./en/functions/image.xml, last change in rev 1.36 -->
<refentry id="function.imagecolorsforindex">
<refnamediv>
@ -14,10 +14,52 @@
<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
This returns an associative array with red, green, blue and alpha
keys that contain the appropriate values for the specified color
index.
</para>
<para>
<example>
<title><function>imagecolorsforindex</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
// open an image
$im = imagecreatefrompng('nexen.png');
// get a color
$start_x = 40;
$start_y = 50;
$color_index = imagecolorat($im, $start_x, $start_y);
// make it human readable
$color_tran = imagecolorsforindex($im, $color_index);
// what is it ?
echo '<pre>';
print_r($color_tran);
echo '</pre>';
?>
]]>
</programlisting>
<para>
This example will output :
</para>
<screen>
<![CDATA[
Array
(
[red] => 226
[green] => 222
[blue] => 252
[alpha] => 0
)
]]>
</screen>
</example>
</para>
<para>
See also <function>imagecolorat</function> and
<function>imagecolorexact</function>.

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.7 $ -->
<!-- $Revision: 1.8 $ -->
<!-- splitted from ./en/functions/image.xml, last change in rev 1.2 -->
<refentry id="function.imagecreatefromgif">
<refnamediv>
@ -24,7 +24,7 @@
<example>
<title>
Example to handle an error during creation (courtesy
vic@zymsys.com)
vic at zymsys dot com)
</title>
<programlisting role="php">
<![CDATA[

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.5 $ -->
<!-- $Revision: 1.6 $ -->
<!-- splitted from ./en/functions/image.xml, last change in rev 1.4 -->
<refentry id="function.imagecreatefromjpeg">
<refnamediv>
@ -24,7 +24,7 @@
<example>
<title>
Example to handle an error during creation (courtesy
vic@zymsys.com )
vic at zymsys dot com )
</title>
<programlisting role="php">
<![CDATA[

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.5 $ -->
<!-- $Revision: 1.6 $ -->
<!-- splitted from ./en/functions/image.xml, last change in rev 1.4 -->
<refentry id="function.imagecreatefrompng">
<refnamediv>
@ -24,7 +24,7 @@
<example>
<title>
Example to handle an error during creation (courtesy
vic@zymsys.com)
vic at zymsys dot com)
</title>
<programlisting role="php">
<![CDATA[

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.5 $ -->
<!-- $Revision: 1.6 $ -->
<!-- splitted from ./en/functions/image.xml, last change in rev 1.30 -->
<refentry id="function.imagecreatefromwbmp">
<refnamediv>
@ -24,7 +24,7 @@
<example>
<title>
Example to handle an error during creation (courtesy
vic@zymsys.com)
vic at zymsys dot com)
</title>
<programlisting role="php">
<![CDATA[

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- $Revision: 1.5 $ -->
<!-- splitted from ./en/functions/image.xml, last change in rev 1.36 -->
<refentry id="function.imagefilledarc">
<refnamediv>
@ -46,7 +46,53 @@
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>
<para>
<example>
<title>Creating a 3D looking pie</title>
<programlisting role="php">
<![CDATA[
<?php
// this example is provided by poxy at klam dot is
// create image
$image = imagecreate(100, 100);
// allocate some solors
$white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
$gray = imagecolorallocate($image, 0xC0, 0xC0, 0xC0);
$darkgray = imagecolorallocate($image, 0x90, 0x90, 0x90);
$navy = imagecolorallocate($image, 0x00, 0x00, 0x80);
$darknavy = imagecolorallocate($image, 0x00, 0x00, 0x50);
$red = imagecolorallocate($image, 0xFF, 0x00, 0x00);
$darkred = imagecolorallocate($image, 0x90, 0x00, 0x00);
// make the 3D effect
for ($i = 60; $i > 50; $i--) {
imagefilledarc($image, 50, $i, 100, 50, 0, 45, $darknavy, IMG_ARC_PIE);
imagefilledarc($image, 50, $i, 100, 50, 45, 75 , $darkgray, IMG_ARC_PIE);
imagefilledarc($image, 50, $i, 100, 50, 75, 360 , $darkred, IMG_ARC_PIE);
}
imagefilledarc($image, 50, 50, 100, 50, 0, 45, $navy, IMG_ARC_PIE);
imagefilledarc($image, 50, 50, 100, 50, 45, 75 , $gray, IMG_ARC_PIE);
imagefilledarc($image, 50, 50, 100, 50, 75, 360 , $red, IMG_ARC_PIE);
// flush image
header('Content-type: image/png');
imagepng($image);
imagedestroy($image);
?>
]]>
</programlisting>
</example>
</para>
<note>
<para>
This function was added in PHP 4.0.6 and requires GD 2.0.1
</para>
</note>
</refsect1>
</refentry>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- $Revision: 1.5 $ -->
<!-- splitted from ./en/functions/image.xml, last change in rev 1.36 -->
<refentry id="function.imagefilledellipse">
<refnamediv>
@ -25,7 +25,11 @@
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>
<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>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- $Revision: 1.5 $ -->
<!-- splitted from ./en/functions/image.xml, last change in rev 1.2 -->
<refentry id="function.imagefilledpolygon">
<refnamediv>
@ -23,6 +23,51 @@
= x1, points[3] = y1, etc. <parameter>num_points</parameter> is
the total number of vertices.
</para>
<para>
<example>
<title><function>imagefilledpolygon</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
// this example is provided by ecofarm at mullum dot com dot au
// set up array of points for polygon
$values = array(
0 => 40, // x1
1 => 50, // y1
2 => 20, // x2
3 => 240, // y2
4 => 60, // x3
5 => 60, // y3
6 => 240, // x4
7 => 20, // y4
8 => 50, // x5
9 => 40, // y5
10 => 10, // x6
11 => 10, // y6
);
// create image
$im = imagecreate(250, 250);
// some colors
$bg = imagecolorallocate($im, 255, 255, 255);
$blue = imagecolorallocate($im, 0, 0, 255);
// draw a polygon
imagefilledpolygon($im, $values, 6, $blue );
// flush image
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>