diff --git a/functions/image.xml b/functions/image.xml index 5a7deab020..dd0bd2ab7e 100644 --- a/functions/image.xml +++ b/functions/image.xml @@ -463,6 +463,81 @@ function LoadGif($imgname) + + + ImageCreateFromJpeg + create a new image from file or URL + + + Description + + int imagecreatefromjpeg + string filename + + + imagecreatefromjpeg returns an image identifier + representing the image obtained from the given filename. + + imagecreatefromjpeg 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 JPEG: + + Example to handle an error during creation (courtesy vic@zymsys.com ) + +function LoadJpeg($imgname) +{ + $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); + ImageString($im,1,5,5,"Error loading $imgname",$tc); /* Output an errmsg */ + } + return $im; +} + + + + + + + ImageCreateFromPNG + create a new image from file or URL + + + Description + + int imagecreatefrompng + string filename + + + 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 (courtesy vic@zymsys.com ) + +function LoadPNG($imgname) +{ + $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); + ImageString($im,1,5,5,"Error loading $imgname",$tc); /* Output an errmsg */ + } + return $im; +} + + + ImageDashedLine @@ -641,7 +716,7 @@ function LoadGif($imgname) int imagegif int im - string filename + string filename imagegif creates the GIF file in filename @@ -667,6 +742,39 @@ function LoadGif($imgname) + + + ImageJpeg + output image to browser or file + + + Description + + int imagejpeg + int im + string filename + int quality + + + imagejpeg creates the JPEG 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. To skip the filename argument in order + to provide a quality argument just use an empty string (''). By sending + an image/jpg content-type using header, you can create a + PHP script that outputs JPEG images directly. + + + JPEG support is only available in PHP if PHP was compiled against GD-1.8 + or later. + + + + + ImageInterlace