Manußl PHP | ||
---|---|---|
P°edchßzejφcφ | Dal╣φ |
ImageGIF() creates the GIF file in filename from the image im. The im argument is the return from the imagecreate() function.
The image format will be GIF87a unless the image has been made transparent with ImageColorTransparent(), in which case the image format will be GIF89a.
The filename argument is optional, and if left off, the raw image stream will be output directly. By sending an image/gif content-type using header(), you can create a PHP script that outputs GIF images directly.
Poznßmka: Since all GIF support was removed from the GD library in version 1.6, this function is not available if you are using that version of the GD library.
The following code snippet allows you to write more 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:
<?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 die("No image support in this PHP server"); ?>
Poznßmka: As of version 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:
See also ImagePNG(), ImageWBMP(), ImageJPEG(), ImageTypes().
P°edchßzejφcφ | Dom∙ | Dal╣φ |
ImageGD2 | Nahoru | ImagePNG |