imagegif
imagegif
gd.image.output
bool **imagegif** GdImage $image $file
creates the
file in from the image . The
argument is the return from the
or
function.
imagegif``file``image``image``imagecreate``imagecreatefrom*
The image format will be unless the
image has been made transparent with
, in which case the
image format will be .
imagecolortransparent
filegd.image.path
return.success
**Voorbeeld: Outputting an image using **
<?php
// Create a new image instance
$im = imagecreatetruecolor(100, 100);
// Make the background white
imagefilledrectangle($im, 0, 0, 99, 99, 0xFFFFFF);
// Draw a text string on the image
imagestring($im, 3, 40, 20, 'GD Library', 0xFFBA00);
// Output the image to browser
header('Content-Type: image/gif');
imagegif($im);
?>
**Voorbeeld: Converting a PNG image to GIF using **
<?php
// Load the PNG
$png = imagecreatefrompng('./php.png');
// Save the image as a GIF
imagegif($png, './php.gif');
// We're done
echo 'Converted PNG image to GIF with success!';
?>
Opmerking: > 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 by the more flexible sequence:
`header ("Content-Type: image/gif"); imagegif ($im);````php
Opmerking: > You can use the function for checking the presence of the various supported image formats:
`imagetypes````php
imagepng``imagewbmp``imagejpeg``imagetypes