note 29433 added to function.imagecreatefromgif

From: Date: Thu, 13 Feb 2003 13:27:59 +0000
Subject: note 29433 added to function.imagecreatefromgif
Groups: php.notes 
Request: Send a blank email to php-notes+get-43880@lists.php.net to get a copy of this message
For users who just want GIF read (not write) support but: 1) Don't want to patch GD libs 2) Don't want to recompile something 3) Don't have permissions to install conversion packages 4) Any other reason... I created a small php script (around 25KB) which lets you load a GIF from a file (you even can specify the image index on animated GIFs) and then convert it to a PNG or BMP file. If I take one example: <? include("gif.php"); $gif = gif_loadFile("./test.gif"); if($gif) { // GIF file successfully opened if(gif_outputAsPNG($gif, "./test.png")) { // Now, just use ImageCreateFromPng... $img = ImageCreateFromPng("./test.png"); if($img) { header("Content-Type: image/jpeg"); ImageJPEG($img); ImageDestroy($img); } else { // Could NOT open PNG } } else { // Could NOT convert GIF to PNG... } } else { // GIF not loaded... } ?> Of course, it's slower than using appropriate software and/or libraries but it's quite useful for reading occasionaly some GIF files. You'll find the gif.php source code at: http://www.yamasoft.com/php-gif.zip Fabien -- http://www.php.net/manual/en/function.imagecreatefromgif.php http://master.php.net/manage/user-notes.php?action=edit+29433 http://master.php.net/manage/user-notes.php?action=delete+29433 http://master.php.net/manage/user-notes.php?action=reject+29433

« previous php.notes (#43880) next »