mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
converting function names in examples to be lowercase
fixing getimagesize example: it was not good HTML fixing layout of examples: they were not spaced correctly git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@76801 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
e84fd5e965
commit
d382e105e4
1 changed files with 110 additions and 111 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.90 $ -->
|
||||
<!-- $Revision: 1.91 $ -->
|
||||
<reference id="ref.image">
|
||||
<title>Image functions</title>
|
||||
<titleabbrev>Image</titleabbrev>
|
||||
|
@ -358,21 +358,23 @@ THUMBNAIL.Thumbnail.Height: 1
|
|||
height="yyy" width="xxx" string that can be used directly in an IMG
|
||||
tag.
|
||||
<example>
|
||||
<title>GetImageSize (file)</title>
|
||||
<title>getimagesize (file)</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php $size = GetImageSize ("img/flag.jpg"); ?>
|
||||
<IMG SRC="img/flag.jpg" <?php echo $size[3]; ?>
|
||||
<?php
|
||||
$size = getimagesize ("img/flag.jpg");
|
||||
echo "<img src='img/flag.jpg' '{$size[3]}'>";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>GetImageSize (URL)</title>
|
||||
<title>getimagesize (URL)</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php $size = GetImageSize ("http://www.example.com/gifs/logo.gif"); ?>
|
||||
<?php $size = getimagesize ("http://www.example.com/gifs/logo.gif"); ?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
@ -400,15 +402,15 @@ THUMBNAIL.Thumbnail.Height: 1
|
|||
function to parse the binary APP13 marker into something
|
||||
readable.
|
||||
<example>
|
||||
<title>GetImageSize returning IPTC</title>
|
||||
<title>getimagesize returning IPTC</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
<?php
|
||||
$size = GetImageSize ("testimg.jpg",&$info);
|
||||
if (isset ($info["APP13"])) {
|
||||
$iptc = iptcparse ($info["APP13"]);
|
||||
var_dump ($iptc);
|
||||
}
|
||||
$size = getimagesize ("testimg.jpg",&$info);
|
||||
if (isset ($info["APP13"])) {
|
||||
$iptc = iptcparse ($info["APP13"]);
|
||||
var_dump ($iptc);
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
|
@ -441,7 +443,7 @@ THUMBNAIL.Thumbnail.Height: 1
|
|||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>image2WBMP</methodname>
|
||||
<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>
|
||||
|
@ -743,8 +745,8 @@ THUMBNAIL.Thumbnail.Height: 1
|
|||
<informalexample>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
$white = ImageColorAllocate ($im, 255, 255, 255);
|
||||
$black = ImageColorAllocate ($im, 0, 0, 0);
|
||||
$white = imagecolorallocate ($im, 255, 255, 255);
|
||||
$black = imagecolorallocate ($im, 0, 0, 0);
|
||||
]]>
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
|
@ -774,8 +776,8 @@ $black = ImageColorAllocate ($im, 0, 0, 0);
|
|||
<informalexample>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
$white = ImageColorAllocate($im, 255, 255, 255);
|
||||
ImageColorDeAllocate($im, $white);
|
||||
$white = imagecolorallocate ($im, 255, 255, 255);
|
||||
imagecolordeallocate ($im, $white);
|
||||
]]>
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
|
@ -1142,7 +1144,7 @@ ImageColorDeAllocate($im, $white);
|
|||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>ImageCopy</methodname>
|
||||
<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>
|
||||
|
@ -1172,7 +1174,7 @@ ImageColorDeAllocate($im, $white);
|
|||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>ImageCopyMerge</methodname>
|
||||
<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>
|
||||
|
@ -1208,7 +1210,7 @@ ImageColorDeAllocate($im, $white);
|
|||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>ImageCopyMergeGray</methodname>
|
||||
<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>
|
||||
|
@ -1346,12 +1348,12 @@ ImageColorDeAllocate($im, $white);
|
|||
<![CDATA[
|
||||
<?php
|
||||
header ("Content-type: image/png");
|
||||
$im = @ImageCreate (50, 100)
|
||||
$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);
|
||||
$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>
|
||||
|
@ -1504,14 +1506,14 @@ ImagePng ($im);
|
|||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
function LoadGif ($imgname) {
|
||||
$im = @ImageCreateFromGIF ($imgname); /* Attempt to open */
|
||||
$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);
|
||||
$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);
|
||||
imagestring ($im, 1, 5, 5, "Error loading $imgname", $tc);
|
||||
}
|
||||
return $im;
|
||||
}
|
||||
|
@ -1557,14 +1559,14 @@ function LoadGif ($imgname) {
|
|||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
function LoadJpeg ($imgname) {
|
||||
$im = @ImageCreateFromJPEG ($imgname); /* Attempt to open */
|
||||
$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);
|
||||
$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);
|
||||
imagestring ($im, 1, 5, 5, "Error loading $imgname", $tc);
|
||||
}
|
||||
return $im;
|
||||
}
|
||||
|
@ -1603,14 +1605,14 @@ function LoadJpeg ($imgname) {
|
|||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
function LoadPNG ($imgname) {
|
||||
$im = @ImageCreateFromPNG ($imgname); /* Attempt to open */
|
||||
$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);
|
||||
$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);
|
||||
imagestring ($im, 1, 5, 5, "Error loading $imgname", $tc);
|
||||
}
|
||||
return $im;
|
||||
}
|
||||
|
@ -1649,14 +1651,14 @@ function LoadPNG ($imgname) {
|
|||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
function LoadWBMP ($imgname) {
|
||||
$im = @ImageCreateFromWBMP ($imgname); /* Attempt to open */
|
||||
$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);
|
||||
$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);
|
||||
imagestring ($im, 1, 5, 5, "Error loading $imgname", $tc);
|
||||
}
|
||||
return $im;
|
||||
}
|
||||
|
@ -1990,28 +1992,28 @@ function LoadWBMP ($imgname) {
|
|||
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:
|
||||
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
|
||||
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");
|
||||
?>
|
||||
]]>
|
||||
|
@ -2028,11 +2030,11 @@ function LoadWBMP ($imgname) {
|
|||
<informalexample>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
if (ImageTypes() & IMG_GIF) {
|
||||
Header("Content-type: image/gif");
|
||||
ImageGif($im);
|
||||
if (imagetypes() & IMG_GIF) {
|
||||
header ("Content-type: image/gif");
|
||||
imagegif ($im);
|
||||
}
|
||||
elseif (ImageTypes() & IMG_JPG) {
|
||||
elseif (imagetypes() & IMG_JPG) {
|
||||
... etc.
|
||||
]]>
|
||||
</programlisting>
|
||||
|
@ -2068,8 +2070,8 @@ elseif (ImageTypes() & IMG_JPG) {
|
|||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$im = ImageCreateFromPng("test.png");
|
||||
ImagePng($im);
|
||||
$im = imagecreatefrompng ("test.png");
|
||||
imagepng ($im);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
|
@ -2143,7 +2145,7 @@ ImagePng($im);
|
|||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>imageWBMP</methodname>
|
||||
<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>
|
||||
|
@ -2555,17 +2557,15 @@ ImagePng($im);
|
|||
<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);
|
||||
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>
|
||||
|
@ -2834,31 +2834,31 @@ ImageDestroy ($im);
|
|||
Following example script draws a dashed line from upper left to
|
||||
lower right corner of the canvas:
|
||||
<example>
|
||||
<title>ImageSetStyle</title>
|
||||
<title>imagesetstyle</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
Header ("Content-type: image/png");
|
||||
header ("Content-type: image/png");
|
||||
$im = imagecreate (100, 100);
|
||||
$w = ImageColorAllocate ($im, 255, 255, 255);
|
||||
$red = ImageColorAllocate ($im, 255, 0, 0);
|
||||
$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);
|
||||
$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);
|
||||
/* 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);
|
||||
$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);
|
||||
imagepng ($im);
|
||||
imagedestroy ($im);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
|
@ -3236,18 +3236,17 @@ ImageDestroy ($im);
|
|||
This example script will produce a black GIF 400x30 pixels, with
|
||||
the words "Testing..." in white in the font Arial.
|
||||
<example>
|
||||
<title>ImageTTFText</title>
|
||||
<title>imagettftext</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
Header ("Content-type: image/gif");
|
||||
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);
|
||||
$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>
|
||||
|
@ -3306,11 +3305,11 @@ ImageDestroy ($im);
|
|||
| <literal>IMG_PNG</literal> | <literal>IMG_WBMP</literal>.
|
||||
To check for PNG support, for example, do this:
|
||||
<example>
|
||||
<title>ImageTypes</title>
|
||||
<title>imagetypes</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
if (ImageTypes() & IMG_PNG) {
|
||||
if (imagetypes() & IMG_PNG) {
|
||||
echo "PNG Support is enabled";
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Reference in a new issue