note 12097 deleted from function.imagecreatefromgif by sobak

From: Date: Thu, 01 Dec 2016 12:42:58 +0000
Subject: note 12097 deleted from function.imagecreatefromgif by sobak
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-207837@lists.php.net to get a copy of this message
Note Submitter: chuckg at infinite9 dot com ---- I just thought I'd let you guys know of a workaround for the lack of Gif support in the latest GD...aside from adding the patch. It works just as good, from what I can tell, and is quite nice ;) Here goes: <? //Just grab some general image info $img = "path/to/image.gif"; $imageInfo = GetImagesize($img); if ( $imageInfo[2] == 1 ) { //it's a gif $file = fread(fopen($path, "r"), filesize($path)); $fileHeader = "image/gif"; Header("Content-Type: ".$fileHeader); echo $file; fclose($file); } ?> basically what that does is reads the file..through the "GetImageSize", which still returns if it's a GIF or not, (thank god), then if it's a gif, opens the file through normal filestream, sets the header to image type "gif" then prints it out. Same as doing "ImageCreateFromGif($img)" and "ImageGif($img)", except that it doesn't require GD Gif support. If you have any questions just ask me via email (chuckg@infinite9.com)

« previous php.notes (#207837) next »