note 36928 rejected from function.fpassthru by pollita
| From: | pollita@php.net | Date: | Mon, 27 Oct 2003 18:22:45 +0000 |
| Subject: | note 36928 rejected from function.fpassthru by pollita | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-59386@lists.php.net to get a copy of this message | ||
Note Submitter: imperialgeniusx@yahoo.com
----
Very weird bug with fpassthru vs. fread on IE. I had a page full of thumbnails (for a portal
application showing who was logged in). When I use fpassthru to return the user thumbnails
(www.blah.com/userthumbnail?uid=<userid>), IE would render the thumbnails inconsistently
(between refreshes different images would show with red Xs). After replacing this
header("Content-Type: image/gif");
header("Content-Length: ".filesize($user_dir.$uid."/thumbnail.gif"));
$fn = fopen($user_dir.$uid."/thumbnail.gif", "rb");
fpassthru($fn);
fclose($fn);
with this
header("Content-Type: image/gif");
header("Content-Length: ".filesize($user_dir.$uid."/thumbnail.gif"));
$fn = fopen($user_dir.$uid."/thumbnail.gif", "rb");
while(!feof($fn)) {
$buffer = fread($fn, 4096);
print $buffer;
}
fclose($fn);
IE stopped messing around and started showing things.