note 36928 added to function.fpassthru

From: Date: Mon, 27 Oct 2003 17:55:07 +0000
Subject: note 36928 added to function.fpassthru
Groups: php.notes 
Request: Send a blank email to php-notes+get-59385@lists.php.net to get a copy of this message
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. ---- Manual Page -- http://www.php.net/manual/en/function.fpassthru.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+36928 Delete -- http://master.php.net/manage/user-notes.php?action=delete+36928&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+36928&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#59385) next »