#23056 [Bgs->Opn]: gif and jpeg php generated pictures bug

From: Date: Fri, 04 Apr 2003 18:21:29 +0000
Subject: #23056 [Bgs->Opn]: gif and jpeg php generated pictures bug
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-37156@lists.php.net to get a copy of this message
ID: 23056 User updated by: dan1 at edenpics dot com Reported By: dan1 at edenpics dot com -Status: Bogus +Status: Open Bug Type: Output Control Operating System: Linux RedHat 7.1 -PHP Version: 4.3.1 +PHP Version: 4.3.2RC1 New Comment: Sorry, $output is the file name. here is the correct code: <? header("Content-type: image/gif"); $output="bird.gif"; // file name $fd = fopen($output,"r"); $filelength=filesize($output); $contents = fread($fd,$filelength); echo $contents; fclose($fd); ?> I tried PHP version 4.3.2RC1. The same happens. This bug appears with jpeg (.jpg) files too, with the "e99\r\n" code before the picture datas, and they can only be saved as BMP too. Previous Comments: ------------------------------------------------------------------------ [2003-04-04 11:05:48] sniper@php.net fixed script, using PHP 4.3.2-RC, and it works fine. ------------------------------------------------------------------------ [2003-04-04 11:04:22] sniper@php.net Your script is broken. (what is $output supposed to contain??) ------------------------------------------------------------------------ [2003-04-04 10:56:07] dan1 at edenpics dot com Hello. I found out something strange: when I generate a picture with PHP, the output (sniffed on the net) starts with something like "c02\r\n" before the rest of the picture ("GIF89a.."): this does not frighten Netscape, however IE does display it, but when you want to save it, then it doesn't understand the format and you cannot save the picture in the real format, but only in BMP. I made a little report of what I did to find this out, and saw that huge amount of people had this problem.. Here is the link of the report: http://www.edenpics.com/pub/iebug/iebug2.phtml And here is the code that generates the bug: <? header("Content-type: image/gif"); $fd = fopen("bird.gif","r"); $filelength=filesize($output); $contents = fread($fd,$filelength); echo $contents; fclose($fd); ?> Thank you for looking at this.. it took me time to find it, so I hope this will help ! Kind Regards to you programmer, Daniel ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=23056&edit=1

« previous php.bugs (#37156) next »