Htaccess    html   Php    javascript   Asp   css    maths  Past Questions  Practice Tests Online

imagegif function syntax tag tutorial 2013 Donate at flattr Flattr this





Alert! Connect with 10,000 Chating Online. Join Now

Php imagegif () function

Write your php code

 
<?php ?>

Php Result


Your code below



(PHP 3, PHP 4 , PHP 5)

imagegif -- Output image to browser or file

Syntax

bool imagegif ( resource image [, string filename] )

imagegif() creates the GIF file in filename from the image image. The image 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. Support is expected to return in a version subsequent to the rerelease of GIF support in the GD library in mid 2004. For more information, see the GD Project site.

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:

<?php
if (imagetypes() & IMG_GIF) {
    
header ("Content-type: image/gif");
    
imagegif ($im);
} elseif (
imagetypes() & IMG_JPG) {
    
/* ... etc. */
}
?>

See also imagepng(), imagewbmp(), imagejpeg() and imagetypes().

Php imagegif Function syntax tag

imagegif php code on this is provided for your study purpose, it will guide you to know how create and design a website using php. use it to practice and train your self online



Php imagegif syntax tutorial

php tutorial guide and code design are for easy learning and programming. The code practice section provided at the top is for practising of this syntax. Use the code section up to practice your php programming online. Learning php is very easy, all you need is to use the examples on this site and practice them to perfect your skills.


Function index

Variables

Expressions

Operators

Control-Structures

Cookies

Array

Date & Time

Directory function

File

Image

Operators

Form data handling

Mathematics operators

Mail

Php Mysql

Network Functions

Strings

php tutorial guides,functions, classes, code examples and tags for creating simple dynamic site to mysql database driven sites
 
 
Htaccess    html   Php    javascript   Asp   css    maths  Past Questions  Practice Tests Online