PHP 4.0 Bug #4597: GetImageSize fails under certain gif's

From: Date: Thu, 25 May 2000 22:12:18 +0000
Subject: PHP 4.0 Bug #4597: GetImageSize fails under certain gif's
Groups: php.dev 
Request: Send a blank email to php-dev+get-19449@lists.php.net to get a copy of this message
From: ralph@ceenet.com Operating system: Slackware Linux 7.0 PHP version: 4.0.0 Release PHP Bug Type: Misbehaving function Bug description: GetImageSize fails under certain gif's Hi, I think GetImageSize is having problems with certain sized gifs, If you examine the following code, it attempts to get size information from one of the php logos from the php site and fails. I downloaded big-logo1t.gif and converted it to a .png and it works fine. I've had this happen with my own gif files as well, not all of them, just some. This has only been tested on PHP 4.0 Release <? #This one works. $Banner_URL = "http://www.arcademachine.com/banners/big-logo1t.png"; #This one will work also #$Banner_URL = "http://www.arcademachine.com/banners/bb.gif"; #Uncomment to try this one that fails. #$Banner_URL = "http://www.php.net/logos/big-logo1t.gif"; $Image_Type = array("NULL","GIF","JPG","PNG"); error_reporting(8); global $php_errormsg; if($fp = fopen($Banner_URL, "r")) { $banner = fread( $fp, 1000000 ); $Banner_Temp=uniqid("x"); $fd=fopen($Banner_Temp,"w+"); fwrite($fd,$banner); $var_size = GetImageSize($Banner_Temp); $var_Temp = $var_size[2]; $Banner_Type = $Image_Type[$var_Temp]; $Banner_Width = $var_size[0]; $Banner_Height = $var_size[1]; $file_size = filesize($Banner_Temp); $file_size = round($file_size / 1024 * 100) / 100 . "k"; $Banner_Size = $Banner_Width . "x" . $Banner_Height . " $file_size"; fclose($fd); fclose($fp); unlink($Banner_Temp); print("$Banner_URL<br>"); print("$Banner_Temp<br>"); print("$var_size<br>"); print("$Banner_Type<br>"); print("$Banner_Width<br>"); print("$Banner_Height<br>"); print("$file_size<br>"); print("<br>Last Error = $php_errormsg"); } ?>

« previous php.dev (#19449) next »