Gold Vision Communications / USA
 GOLDVISION.COM
Serving the Multimedia Community since 1989.
German Site | Spanish Site 

 Web Hosting

 Virtual Dedicated Servers

 Domaincheck

 Order

 Order Status

 Support

 Contact us

 Download

 Network

 Network Status

 Webdesign / Templates

 Make Payment

 Terms & Conditions

 Imprint

 Legal Notices

 Privacy Statement
  PHP / ImageGIF
ImageGIF

ImageGIF

(PHP 3, PHP 4 >= 4.0.0)

ImageGIF -- Output image to browser or file

Description

int imagegif ( int im [, string filename])

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.

Note: 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");
?>

Note: 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:

if (ImageTypes() & IMG_GIF) {
    Header("Content-type: image/gif");
    ImageGif($im);
}
elseif (ImageTypes() & IMG_JPG) {
        ... etc.

See also ImagePNG(), ImageWBMP(), ImageJPEG(), ImageTypes().


© 1998-2007 Gold Vision Communications All Rights Reserved.