<?php
GdImage|false imagecreatefromgif( string $filename )
where,
$filename = The path to an existing GIF image
?>
STREAM WRAPPERS | MEANING |
file:// | LOCAL File System |
http:// | URL HTTP |
ftp:// | URL FTP |
php:// | I/O streams |
zlib:// | Data Compression stream |
data:// | DATA (RFC-2397) |
glob:// | Find Filenames |
phar:// | PHP Archive |
ssh2:// | Secure Shell 2 |
rar:// | RAR |
ogg:// | Audio |
expect:// | Interaction of stream processes |
ed48 |
<?php
echo 'PHP VERSION: ' . PHP_VERSION . '<br><br>';
$img_file = "gif/GIF 009 01.gif";
echo $img_file; ?><br><br>Existing Image
<br><br><img src="<?php echo $img_file; ?>"
alt="<?php echo $img_file; ?>" title="G I F" width="400">
<?php
$im01 = imagecreatefromgif($img_file);
echo '<br><br>resource or object for the
future image to be created by this function.<br><br>';
var_dump($im01);
imagedestroy($im01);
?>
<?php
echo 'PHP VERSION: ' . PHP_VERSION . '<br><br>';
$img_file = "gif/GIF 010 02.gif";
$img_name = "png/PNG 019 02 (gif2png).png";
echo $img_file; ?><br><br>( Existing Image )
<br><br><img src="<?php echo $img_file; ?>"
alt="<?php echo $img_file; ?>" title="G I F">
<?php
$im02 = imagecreatefromgif($img_file);
echo '<br><br>$im02<br>The identifier to be used
to create another image format:<br>';
var_dump($im02);
echo '<br><br>';
$bool02 = imagepng($im02, $img_name);
if ($bool02 == true)
{
echo 'The new format of the image
has been created!<br><br>' . $img_name . '<br><br>';
echo '<img src="' . $img_name .
'" alt="' . $img_name . '" title="' . $img_name . '">';
}
else
{
echo '$bool02 = ' . $bool02 .
'<br><br>The image was NOT created!';
}
?>
<?php
echo 'PHP VERSION: ' . PHP_VERSION . '<br><br>';
$img_file = "gif/GIF 011 03.gif";
$img_name = "gd2/GD2 004 03 (gif2gd2).gd2";
echo $img_file; ?><br><br>Existing Image
<br><br><img src="<?php echo $img_file; ?>"
alt="<?php echo $img_file; ?>" title="G I F">
<?php
$im03 = imagecreatefromgif($img_file);
echo '<br><br>$im03<br>The identifier to be used
to create another image format:<br>';
var_dump($im03);
echo '<br><br>';
$bool03 = imagegd2($im03, $img_name);
if ($bool03 == true)
{
echo 'The new format of the image
has been created!<br><br>' . $img_name . '<br><br>';
echo 'Cannot be shown by this browser.<br><br>';
}
else
{
echo '$bool03 = ' . $bool03 .
'<br><br>The image was NOT created!';
}
?>
<?php
echo 'PHP VERSION: ' . PHP_VERSION . '<br><br>';
$img_file = "gif/GIF 011 03.gif";
// PALETTE IMAGE
// ( See the error )
$img_name = "webp/WEBP 004 04 (gif2webp).webp";
echo $img_file; ?><br><br>Existing Image
<br><br><img src="<?php echo $img_file; ?>"
alt="<?php echo $img_file; ?>" title="G I F">
<?php
$im04 = imagecreatefromgif($img_file);
echo '<br><br>$im04<br>The identifier to be used
to create another image format:<br>';
var_dump($im04);
echo '<br><br>';
$bool04 = imagewebp($im04, $img_name);
if ($bool04 == true)
{
echo 'The new format of the image
has been created!<br><br>' . $img_name . '<br><br>';
echo '<img src="' . $img_name .
'" alt="' . $img_name . '" title="' . $img_name . '">';
}
else
{
echo '$bool04 = ' . $bool04 .
'<br><br>The image was NOT created!';
}
?>
<?php
echo 'PHP VERSION: ' . PHP_VERSION . '<br><br>';
$img_file = "gif/GIF 011 03.gif";
$img_name = "xbm/XBM 003 05 (gif2xbm).xbm";
echo $img_file; ?><br><br>Existing Image
<br><br><img src="<?php echo $img_file; ?>"
alt="<?php echo $img_file; ?>" title="G I F">
<?php
$im05 = imagecreatefromgif($img_file);
echo '<br><br>$im05<br>The identifier to be used
to create another image format:<br>';
var_dump($im05);
echo '<br><br>';
$bool05 = imagexbm($im05, $img_name);
if ($bool05 == true)
{
echo 'The new format of the image
has been created!<br><br>';
echo '<img src="' . $img_name .
'" alt="' . $img_name . '" title="' . $img_name . '">';
}
else
{
echo '$bool05 = ' . $bool05 .
'<br><br>The image was NOT created!';
}
?>