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

From: Date: Fri, 26 May 2000 09:33:44 +0000
Subject: Re: PHP 4.0 Bug #4597: GetImageSize fails under certain gif's
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-19478@lists.php.net to get a copy of this message
On Thu, May 25, 2000 at 10:12:18PM -0000, ralph@ceenet.com wrote: > 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 works for me: wget http://www.php.net/logos/big-logo1t.gif /path/to/standalone/php <? var_dump(getimagesize("big-logo1t.gif")); ?> ^D X-Powered-By: PHP/4.0.1-dev Content-type: text/html array(4) { [0]=> int(96) [1]=> int(50) [2]=> int(1) [3]=> string(22) "width="96" height="50"" } what is your problem? tc > > > 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"); > > > } > > > ?> > > > > > -- > PHP Development Mailing List <http://www.php.net/> > To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net > For additional commands, e-mail: php-dev-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net -- Thies C. Arntzen "One Big-Mac, Small Fries and a Coke!" Digital Collections Phone +49 40 235350 Fax +49 40 23535180 Hammerbrookstr. 93 20097 Hamburg / Germany

« previous php.dev (#19478) next »