From 1406cee9c9309bfa265d12e4cd7d94581f396e73 Mon Sep 17 00:00:00 2001 From: foobar Date: Sun, 7 Jan 2001 22:24:04 +0000 Subject: [PATCH] Added documentation for imagecreatefromwbmp() and imagewbmp() functions. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@38841 c90b9560-bf6c-de11-be94-00142212c4b1 --- functions/image.xml | 114 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 103 insertions(+), 11 deletions(-) diff --git a/functions/image.xml b/functions/image.xml index b22774386a..5b55d46f99 100644 --- a/functions/image.xml +++ b/functions/image.xml @@ -811,6 +811,52 @@ function LoadPNG ($imgname) { + + + ImageCreateFromWBMP + Create a new image from file or URL + + + Description + + + int imagecreatefromwbmp + string filename + + + + 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 (courtesy + vic@zymsys.com) + + +function LoadWBMP ($imgname) { + $im = @ImageCreateFromWBMP ($imgname); /* Attempt to open */ + if (!$im) { /* See if it failed */ + $im = ImageCreate (20, 20); /* Create a blank image */ + $bgc = ImageColorAllocate ($im, 255, 255, 255); + $tc = ImageColorAllocate ($im, 0, 0, 0); + ImageFilledRectangle ($im, 0, 0, 10, 10, $bgc); + /* Output an errmsg */ + ImageString ($im, 1, 5, 5, "Error loading $imgname", $tc); + } + return $im; +} + + + + + + ImageDashedLine @@ -1063,21 +1109,25 @@ function LoadPNG ($imgname) { portable PHP applications by auto-detecting the type of GD support which is available. Replace the sequence Header("Content-type: image/gif"); - ImageGif($im); by the more flexible sequence: + ImageGIF($im); by the more flexible sequence: <?php if (function_exists("imagegif")) { Header("Content-type: image/gif"); - ImageGif($im); + ImageGIF($im); } elseif (function_exists("imagejpeg")) { Header("Content-type: image/jpeg"); - ImageJpeg($im, "", 0.5); + ImageJPEG($im, "", 0.5); } elseif (function_exists("imagepng")) { Header("Content-type: image/png"); - ImagePng($im); + ImagePNG($im); + } + elseif (function_exists("imagewbmp")) { + Header("Content-type: image/vnd.wap.wbmp"); + ImageWBMP($im); } else die("No image support in this PHP server"); @@ -1105,8 +1155,8 @@ elseif (ImageTypes() & IMG_JPG) { - See also ImagePng, - ImageJpeg, ImageTypes. + See also ImagePNG, ImageWBMP, + ImageJPEG, ImageTypes. @@ -1130,7 +1180,7 @@ elseif (ImageTypes() & IMG_JPG) { - The ImagePng outputs a GD image stream + The ImagePNG outputs a GD image stream (im) in PNG format to standard output (usually the browser) or, if a filename is given by the filename it outputs the image to the file. @@ -1144,8 +1194,8 @@ ImagePng($im); - See also ImageGif, - ImageJpeg, ImageTypes. + See also ImageGIF, ImageWBMP, + ImageJPEG, ImageTypes. @@ -1190,8 +1240,50 @@ ImagePng($im); - See also ImagePng, - ImageGif, ImageTypes. + See also ImagePNG, ImageGIF, + ImageWBMP, ImageTypes. + + + + + + + ImageWBMP + Output image to browser or file + + + Description + + + int imageWBMP + int im + string + filename + + + + + ImageWBMP creates the + WBMP file in filename from the image + im. The im argument + is the return from the ImageCreate function. + + + The filename argument is optional, and if left off, the raw image + stream will be output directly. + By sending an image/vnd.wap.wbmp content-type + using header, you can create + a PHP script that outputs WBMP images directly. + + + WBMP support is only available in PHP if PHP was compiled + against GD-1.8 or later. + + + + + See also ImagePNGImageGIF, + ImageJPEG, ImageTypes.