diff --git a/reference/image/examples.xml b/reference/image/examples.xml
index 8094f8a9fa..ade07c19fb 100644
--- a/reference/image/examples.xml
+++ b/reference/image/examples.xml
@@ -1,5 +1,5 @@
-
+
&reftitle.examples;
@@ -34,6 +34,92 @@ imagedestroy($im);
dynamically generated.
+
+
+
+ Adding watermarks to images using alpha channels
+
+
+]]>
+
+
+
+
+
+
+
+ This example is a common way to add watermarks and stamps to photos and
+ copyrighted images. Note that the presence of an alpha channel in the
+ stamp image as the text is anti-aliased. This is preserved during copying.
+
+
+
+
+
+ Using imagecopymerge to create a translucent watermark
+
+
+]]>
+
+
+
+
+
+
+
+ This example uses imagecopymerge to merge the stamp
+ with our original image. Using this we can set the opacity of our stamp -
+ in our example we've set it to 50% opacity (another term for transparency).
+ In practice this would be useful in copyright protection as semi-transparent
+ watermarks are hard to remove yet allow viewers to see the image.
+
+
+
imagealphablending
@@ -47,6 +47,32 @@
&return.success;
+
+ &reftitle.examples;
+
+ imagealphablending usage example
+
+
+]]>
+
+
+
&reftitle.notes;
¬e.gd.2;
diff --git a/reference/image/functions/imagecolorat.xml b/reference/image/functions/imagecolorat.xml
index 9638f76e2e..f8d053aa8d 100644
--- a/reference/image/functions/imagecolorat.xml
+++ b/reference/image/functions/imagecolorat.xml
@@ -1,5 +1,5 @@
-
+
imagecolorat
@@ -78,6 +78,30 @@ var_dump($r, $g, $b);
int(119)
int(123)
int(180)
+]]>
+
+
+
+ Human-readable RGB values using imagecolorsforindex
+
+
+]]>
+
+ &example.outputs.similar;
+
+
diff --git a/reference/image/functions/imagecolorclosesthwb.xml b/reference/image/functions/imagecolorclosesthwb.xml
index 8ef2669063..438e9317f5 100644
--- a/reference/image/functions/imagecolorclosesthwb.xml
+++ b/reference/image/functions/imagecolorclosesthwb.xml
@@ -1,5 +1,5 @@
-
+
imagecolorclosesthwb
@@ -111,7 +111,6 @@ HWB: 33
imagecolorclosest
- imagecolorclosesthwb
diff --git a/reference/image/functions/imagecolorexact.xml b/reference/image/functions/imagecolorexact.xml
index f193131940..008eee51df 100644
--- a/reference/image/functions/imagecolorexact.xml
+++ b/reference/image/functions/imagecolorexact.xml
@@ -1,5 +1,5 @@
-
+
imagecolorexact
@@ -62,6 +62,41 @@
color does not exist.
+
+
+ Get colors from the GD logo
+
+
+]]>
+
+ &example.outputs.similar;
+
+ 16711680
+ [1] => 0
+ [2] => 16777215
+ [3] => 6618932
+)
+]]>
+
+
&reftitle.seealso;
diff --git a/reference/image/functions/imagecolorexactalpha.xml b/reference/image/functions/imagecolorexactalpha.xml
index af6e4a4d04..52a15be8f9 100644
--- a/reference/image/functions/imagecolorexactalpha.xml
+++ b/reference/image/functions/imagecolorexactalpha.xml
@@ -1,5 +1,5 @@
-
+
imagecolorexactalpha
@@ -71,6 +71,42 @@
image, or -1 if the color does not exist in the image's palette.
+
+
+ Get colors from the GD logo
+
+
+]]>
+
+ &example.outputs.similar;
+
+ 16711680
+ [1] => 2130706432
+ [2] => 939524095
+ [3] => 342163252
+)
+]]>
+
+
&reftitle.notes;
¬e.gd.2;
diff --git a/reference/image/functions/imagecolormatch.xml b/reference/image/functions/imagecolormatch.xml
index e768cc56b3..b8e96318ed 100644
--- a/reference/image/functions/imagecolormatch.xml
+++ b/reference/image/functions/imagecolormatch.xml
@@ -1,5 +1,5 @@
-
+
imagecolormatch
@@ -46,6 +46,33 @@
&return.success;
+
+
+ imagecolormatch example
+
+
+]]>
+
+
+
&reftitle.notes;
¬e.bundled.gd;
diff --git a/reference/image/functions/imagecolorresolve.xml b/reference/image/functions/imagecolorresolve.xml
index dcab1d389b..b7655b39cc 100644
--- a/reference/image/functions/imagecolorresolve.xml
+++ b/reference/image/functions/imagecolorresolve.xml
@@ -1,5 +1,5 @@
-
+
imagecolorresolve
@@ -62,6 +62,40 @@
Returns a color index.
+
+ &refitle.examples;
+
+ Using imagecoloresolve to get colors from an image
+
+
+]]>
+
+ &example.outputs.similar;
+
+ 89
+ [1] => 85
+)
+]]>
+
+
+
&reftitle.seealso;
diff --git a/reference/image/functions/imagecolorresolvealpha.xml b/reference/image/functions/imagecolorresolvealpha.xml
index d7611278bd..539fb4fcd8 100644
--- a/reference/image/functions/imagecolorresolvealpha.xml
+++ b/reference/image/functions/imagecolorresolvealpha.xml
@@ -1,5 +1,5 @@
-
+
imagecolorresolvealpha
@@ -71,6 +71,40 @@
Returns a color index.
+
+ &refitle.examples;
+
+ Using imagecoloresolve to get colors from an image
+
+
+]]>
+
+ &example.outputs.similar;
+
+ 89
+ [1] => 85
+)
+]]>
+
+
+
&reftitle.notes;
¬e.gd.2;
diff --git a/reference/image/functions/imagecolorset.xml b/reference/image/functions/imagecolorset.xml
index 393d1b8ad2..2fcb577f9f 100644
--- a/reference/image/functions/imagecolorset.xml
+++ b/reference/image/functions/imagecolorset.xml
@@ -1,11 +1,10 @@
-
+
imagecolorset
Set the color for the specified palette index
-
&reftitle.description;
@@ -23,7 +22,6 @@
flood-fill.
-
&reftitle.parameters;
@@ -64,14 +62,12 @@
-
&reftitle.returnvalues;
&return.void;
-
&reftitle.examples;
@@ -103,7 +99,6 @@ imagedestroy($im);
-
&reftitle.seealso;
diff --git a/reference/image/functions/imagecopyresized.xml b/reference/image/functions/imagecopyresized.xml
index ee700f2c3a..57797f34c1 100644
--- a/reference/image/functions/imagecopyresized.xml
+++ b/reference/image/functions/imagecopyresized.xml
@@ -1,5 +1,5 @@
-
+
imagecopyresized
@@ -176,7 +176,7 @@ imagejpeg($thumb);
&example.outputs.similar;
-
+
diff --git a/reference/image/functions/imagecreatefromgif.xml b/reference/image/functions/imagecreatefromgif.xml
index 52c8ff45de..ae3f8686cd 100644
--- a/reference/image/functions/imagecreatefromgif.xml
+++ b/reference/image/functions/imagecreatefromgif.xml
@@ -1,5 +1,5 @@
-
+
imagecreatefromgif
@@ -15,41 +15,6 @@
imagecreatefromgif returns an image identifier
representing the image obtained from the given filename.
-
- To ease debugging the following example will produce an error GIF:
-
- Example to handle an error during creation
-
-
-]]>
-
- &example.outputs.similar;
-
-
-
-
-
-
-
&tip.fopen-wrapper;
@@ -73,6 +38,51 @@ imagedestroy($img);
Returns an image resource identifier on success, &false; on errors.
+
+
+ Example to handle an error during loading of a GIF
+
+
+]]>
+
+ &example.outputs.similar;
+
+
+
+
+
+
+
&reftitle.notes;
diff --git a/reference/image/functions/imagecreatefromjpeg.xml b/reference/image/functions/imagecreatefromjpeg.xml
index 49734cb970..3ccbb1acf4 100644
--- a/reference/image/functions/imagecreatefromjpeg.xml
+++ b/reference/image/functions/imagecreatefromjpeg.xml
@@ -1,5 +1,5 @@
-
+
imagecreatefromjpeg
@@ -15,44 +15,6 @@
imagecreatefromjpeg returns an image identifier
representing the image obtained from the given filename.
-
- On failure imagecreatefromjpeg outputs an error message,
- which unfortunately
- displays as a broken link in a browser. To ease debugging the
- following example will produce an error JPEG:
-
- Example to handle an error during creation
-
-
-]]>
-
- &example.outputs.similar;
-
-
-
-
-
-
-
&tip.fopen-wrapper;
@@ -76,6 +38,51 @@ imagedestroy($img);
Returns an image resource identifier on success, &false; on errors.
+
+
+ Example to handle an error during loading of a JPEG
+
+
+]]>
+
+ &example.outputs.similar;
+
+
+
+
+
+
+
&reftitle.notes;
¬e.config.jpeg;
diff --git a/reference/image/functions/imagecreatefrompng.xml b/reference/image/functions/imagecreatefrompng.xml
index e6687c171e..d7f5d10980 100644
--- a/reference/image/functions/imagecreatefrompng.xml
+++ b/reference/image/functions/imagecreatefrompng.xml
@@ -1,5 +1,5 @@
-
+
imagecreatefrompng
@@ -15,44 +15,6 @@
imagecreatefrompng returns an image identifier
representing the image obtained from the given filename.
-
- imagecreatefrompng 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 PNG:
-
- Example to handle an error during creation
-
-
-]]>
-
- &example.outputs.similar;
-
-
-
-
-
-
-
&tip.fopen-wrapper;
@@ -76,6 +38,46 @@ imagedestroy($img);
Returns an image resource identifier on success, &false; on errors.
+
+ &reftitle.examples;
+
+ Example to handle an error during loading of a PNG
+
+
+]]>
+
+
+
&reftitle.notes;
&warn.no-win32-fopen-wrapper;
diff --git a/reference/image/functions/imagecreatefromwbmp.xml b/reference/image/functions/imagecreatefromwbmp.xml
index ffda1cb8ab..c437069f3e 100644
--- a/reference/image/functions/imagecreatefromwbmp.xml
+++ b/reference/image/functions/imagecreatefromwbmp.xml
@@ -1,5 +1,5 @@
-
+
imagecreatefromwbmp
@@ -15,34 +15,6 @@
imagecreatefromwbmp returns an image identifier
representing the image obtained from the given filename.
-
- imagecreatefromwbmp 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 WBMP:
-
- Example to handle an error during creation
-
-
-]]>
-
-
-
&tip.fopen-wrapper;
@@ -66,6 +38,46 @@ function LoadWBMP($imgname)
Returns an image resource identifier on success, &false; on errors.
+
+ &reftitle.examples;
+
+ Example to handle an error during loading of a WBMP
+
+
+]]>
+
+
+
&reftitle.notes;
¬e.config.wbmp;
diff --git a/reference/image/functions/imagecreatefromxbm.xml b/reference/image/functions/imagecreatefromxbm.xml
index 8b300affb1..b7dc168198 100644
--- a/reference/image/functions/imagecreatefromxbm.xml
+++ b/reference/image/functions/imagecreatefromxbm.xml
@@ -1,5 +1,5 @@
-
+
imagecreatefromxbm
@@ -16,7 +16,6 @@
representing the image obtained from the given filename.
&tip.fopen-wrapper;
- &warn.no-win32-fopen-wrapper;
&reftitle.parameters;
@@ -59,6 +58,10 @@ imagedestroy($xbm);
+
+ &reftitle.notes;
+ &warn.no-win32-fopen-wrapper;
+
+
imagefilter
@@ -189,7 +189,6 @@
&return.success;
-
&reftitle.changelog;
@@ -213,7 +212,6 @@
-
&reftitle.examples;
@@ -223,10 +221,15 @@
]]>
@@ -261,14 +268,63 @@ imagedestroy($im);
$im = imagecreatefrompng('philip.png');
/* R, G, B, so 0, 255, 0 is green */
-if ($im && imagefilter($im, IMG_FILTER_COLORIZE, 0, 255, 0)) {
+if($im && imagefilter($im, IMG_FILTER_COLORIZE, 0, 255, 0))
+{
echo 'Image successfully shaded green.';
+
imagepng($im, 'philip.png');
-} else {
+ imagedestroy($im);
+}
+else
+{
echo 'Green shading failed.';
}
+?>
+]]>
+
+
+
+ imagefilter negate example
+
+
]]>
diff --git a/reference/image/functions/imageftbbox.xml b/reference/image/functions/imageftbbox.xml
index 6685d08828..c452fe9edd 100644
--- a/reference/image/functions/imageftbbox.xml
+++ b/reference/image/functions/imageftbbox.xml
@@ -1,5 +1,5 @@
-
+
imageftbbox
@@ -24,7 +24,8 @@
size
- The font size in pixels.
+ The font size. Depending on your version of GD, this should be
+ specified as the pixel size (GD1) or point size (GD2).
@@ -136,6 +137,45 @@
corner seeing the text horizontally.
+
+ &reftitle.examples;
+
+
+ imageftbbox example
+
+
+]]>
+
+
+
+
&reftitle.notes;
¬e.gd.2;
diff --git a/reference/image/functions/imagefttext.xml b/reference/image/functions/imagefttext.xml
index 968725f86c..3a2a289345 100644
--- a/reference/image/functions/imagefttext.xml
+++ b/reference/image/functions/imagefttext.xml
@@ -1,5 +1,5 @@
-
+
imagefttext
@@ -28,7 +28,8 @@
size
- The font size to use in points.
+
+ The font size to use in points.
diff --git a/reference/image/functions/imagegd.xml b/reference/image/functions/imagegd.xml
index c6faae70fe..a6d1f653cc 100644
--- a/reference/image/functions/imagegd.xml
+++ b/reference/image/functions/imagegd.xml
@@ -1,5 +1,5 @@
-
+
imagegd
@@ -39,6 +39,52 @@
&return.success;
+
+ &reftitle.examples;
+
+
+ Outputting a GD image
+
+
+]]>
+
+
+
+
+
+ Saving a GD image
+
+
+]]>
+
+
+
+
&reftitle.notes;
diff --git a/reference/image/functions/imagegd2.xml b/reference/image/functions/imagegd2.xml
index 6d5a317327..985c42dcfc 100644
--- a/reference/image/functions/imagegd2.xml
+++ b/reference/image/functions/imagegd2.xml
@@ -1,5 +1,5 @@
-
+
imagegd2
@@ -59,6 +59,51 @@
&return.success;
+
+ &reftitle.examples;
+
+
+ Outputting a GD2 image
+
+
+]]>
+
+
+
+
+
+ Saving a GD2 image
+
+
+]]>
+
+
+
+
&reftitle.notes;
¬e.gd.2;
diff --git a/reference/image/functions/imagegif.xml b/reference/image/functions/imagegif.xml
index 27b327ed47..0a70677a7b 100644
--- a/reference/image/functions/imagegif.xml
+++ b/reference/image/functions/imagegif.xml
@@ -1,5 +1,5 @@
-
+
imagegif
@@ -49,6 +49,55 @@
&return.success;
+
+ &reftitle.examples;
+
+
+ Outputting an image using imagegif
+
+
+]]>
+
+
+
+ Converting a PNG image to GIF using imagegif
+
+
+]]>
+
+
+
+
&reftitle.notes;
@@ -71,20 +120,52 @@
]]>
@@ -94,7 +175,7 @@ if (function_exists("imagegif")) {
- As of version 3.0.18 and 4.0.2 you can use the function
+ As of PHP 3.0.18 and 4.0.2 you can use the function
imagetypes in place of
function_exists for checking
the presence of the various supported image formats:
@@ -102,10 +183,13 @@ if (function_exists("imagegif")) {
diff --git a/reference/image/functions/imagelayereffect.xml b/reference/image/functions/imagelayereffect.xml
index b18c4a04f8..304e27d9a3 100755
--- a/reference/image/functions/imagelayereffect.xml
+++ b/reference/image/functions/imagelayereffect.xml
@@ -1,5 +1,5 @@
-
+
imagelayereffect
@@ -76,6 +76,42 @@
&return.success;
+
+
+ imagelayereffect example
+
+
+]]>
+
+ &example.outputs.similar;
+
+
+
+
+
+
+
&reftitle.notes;
¬e.bundled.gd;
diff --git a/reference/image/functions/imageline.xml b/reference/image/functions/imageline.xml
index c08f80bb01..762025a6d5 100644
--- a/reference/image/functions/imageline.xml
+++ b/reference/image/functions/imageline.xml
@@ -1,5 +1,5 @@
-
+
imageline
@@ -17,7 +17,7 @@
intcolor
- imageline draws a line between the two given points.
+ Draws a line between the two given points.
diff --git a/reference/image/functions/imageloadfont.xml b/reference/image/functions/imageloadfont.xml
index d8f332a8c4..38f4bb6315 100644
--- a/reference/image/functions/imageloadfont.xml
+++ b/reference/image/functions/imageloadfont.xml
@@ -1,5 +1,5 @@
-
+
imageloadfont
@@ -90,18 +90,27 @@
&reftitle.examples;
- Using imageloadfont
+ imageloadfont usage example
]]>
diff --git a/reference/image/functions/imagepng.xml b/reference/image/functions/imagepng.xml
index a3c3c2e4c8..a010f57e02 100644
--- a/reference/image/functions/imagepng.xml
+++ b/reference/image/functions/imagepng.xml
@@ -1,5 +1,5 @@
-
+
imagepng
@@ -107,7 +107,11 @@
]]>
diff --git a/reference/image/functions/imagepolygon.xml b/reference/image/functions/imagepolygon.xml
index e07dbce03d..ee00e7312d 100644
--- a/reference/image/functions/imagepolygon.xml
+++ b/reference/image/functions/imagepolygon.xml
@@ -1,5 +1,5 @@
-
+
imagepolygon
@@ -28,8 +28,29 @@
points
- An array containing the polygon's vertices, i.e. points[0] = x0,
- points[1] = y0, points[2] = x1, points[3] = y1, etc.
+ An array containing the polygon's vertices, e.g.:
+
+
+
+
+ points[0]
+ = x0
+
+
+ points[1]
+ = y0
+
+
+ points[2]
+ = x1
+
+
+ points[3]
+ = y1
+
+
+
+
@@ -67,17 +88,17 @@
]]>
diff --git a/reference/image/functions/imagepsbbox.xml b/reference/image/functions/imagepsbbox.xml
index 5e7fb3587b..deff51201e 100644
--- a/reference/image/functions/imagepsbbox.xml
+++ b/reference/image/functions/imagepsbbox.xml
@@ -1,5 +1,5 @@
-
+
imagepsbbox
@@ -99,29 +99,66 @@
Returns an array containing the following elements:
-
-
-
- 0
- left x-coordinate
-
-
- 1
- upper y-coordinate
-
-
- 2
- right x-coordinate
-
-
- 3
- lower y-coordinate
-
-
-
+
+
+
+ 0
+ left x-coordinate
+
+
+ 1
+ upper y-coordinate
+
+
+ 2
+ right x-coordinate
+
+
+ 3
+ lower y-coordinate
+
+
+
+
+ &reftitle.examples;
+
+ imagepsbbox usage
+
+
+]]>
+
+
+
&reftitle.notes;
¬e.config.t1lib;
diff --git a/reference/image/functions/imagepsloadfont.xml b/reference/image/functions/imagepsloadfont.xml
index 253762a7e6..e0e5c652eb 100644
--- a/reference/image/functions/imagepsloadfont.xml
+++ b/reference/image/functions/imagepsloadfont.xml
@@ -1,5 +1,5 @@
-
+
imagepsloadfont
@@ -46,14 +46,22 @@
diff --git a/reference/image/functions/imagepstext.xml b/reference/image/functions/imagepstext.xml
index 9769bd9ea6..2ae8ea8093 100644
--- a/reference/image/functions/imagepstext.xml
+++ b/reference/image/functions/imagepstext.xml
@@ -1,5 +1,5 @@
-
+
imagepstext
@@ -168,6 +168,36 @@
+
+ &reftitle.examples;
+
+ imagepstext usage
+
+
+]]>
+
+
+
&reftitle.notes;
¬e.config.t1lib;
diff --git a/reference/image/functions/imagesetbrush.xml b/reference/image/functions/imagesetbrush.xml
index bfcf8b4b8a..4a62f79040 100644
--- a/reference/image/functions/imagesetbrush.xml
+++ b/reference/image/functions/imagesetbrush.xml
@@ -1,5 +1,5 @@
-
+
imagesetbrush
@@ -46,7 +46,7 @@
&reftitle.examples;
- Saving an XBM file
+ imagesetbrush example
-
+
imagesetthickness
@@ -44,7 +44,7 @@
&reftitle.examples;
- Saving an XBM file
+ imagesetthickness example
-
+
imagesettile
@@ -58,7 +58,7 @@
&reftitle.examples;
- Saving an XBM file
+ imagesettile example
-
+
imagestring
@@ -76,19 +76,21 @@
]]>
diff --git a/reference/image/functions/imagettfbbox.xml b/reference/image/functions/imagettfbbox.xml
index a1bde92512..ba3beaed1e 100644
--- a/reference/image/functions/imagettfbbox.xml
+++ b/reference/image/functions/imagettfbbox.xml
@@ -1,5 +1,5 @@
-
+
imagettfbbox
@@ -113,7 +113,57 @@
corner seeing the text horizontally.
-
+
+ &reftitle.examples;
+
+
+ imagettfbbox example
+
+
+]]>
+
+
+
+
+
&reftitle.seealso;
diff --git a/reference/image/functions/imagettftext.xml b/reference/image/functions/imagettftext.xml
index 339cabbbdf..36b6dae546 100644
--- a/reference/image/functions/imagettftext.xml
+++ b/reference/image/functions/imagettftext.xml
@@ -1,5 +1,5 @@
-
+
imagettftext
@@ -166,7 +166,7 @@ $font = 'SomeFont';
-
+
imagewbmp
@@ -83,6 +83,7 @@ imagedestroy($im);
Saving the WBMP image
]]>
diff --git a/reference/image/functions/iptcembed.xml b/reference/image/functions/iptcembed.xml
index cd93321231..b24b287670 100644
--- a/reference/image/functions/iptcembed.xml
+++ b/reference/image/functions/iptcembed.xml
@@ -1,5 +1,5 @@
-
+
iptcembed
@@ -53,6 +53,71 @@
returned as a string, &false; on errors.
+
+ &reftitle.examples;
+
+ Embedding IPTC data into a JPEG
+
+> 8) . chr($length & 0xFF);
+ }
+ else
+ {
+ $retval .= chr(0x80) .
+ chr(0x04) .
+ chr(($length >> 24) & 0xFF) .
+ chr(($length >> 16) & 0xFF) .
+ chr(($length >> 8) & 0xFF) .
+ chr($length & 0xFF);
+ }
+
+ return $retval . $value;
+}
+
+// Path to jpeg file
+$path = './phplogo.jpg';
+
+// We need to check if theres any IPTC data in the jpeg image. If there is then
+// bail out because we cannot embed any image that already has some IPTC data!
+$image = getimagesize($path, $info);
+
+if(isset($info['APP13']))
+{
+ die('Error: IPTC data found in source image, cannot continue');
+}
+
+// Set the IPTC tags
+$iptc = array(
+ '2#120' => 'Test image',
+ '2#116' => 'Copyright 2008, The PHP Group'
+);
+
+// Convert the IPTC tags into binary code
+$data = '';
+
+foreach($iptc as $tag => $string)
+{
+ $tag = substr($tag, 2);
+ $data .= iptc_make_tag(2, substr($tag, 2), $string);
+}
+
+// Embed the IPTC data
+$content = iptcembed($data, $path);
+?>
+]]>
+
+
+
&reftitle.notes;