Hello everyone,
i didn't know that there was already a discussion about those point, i came just for put my solution of extending this excellent assets grabber.( I have also implemented several function to use it with auth, acl and cahce but it's not the point)
The usefull tweak are as jon says on comment 4 a mime-type detection :
first thing it's better to use $this->_response instead of the echo.
with this function you could set a lot of usefull header, i first use an auto-detect mime-type
$this->_response->setHeader('Content-Type',mime_content_type($file_path));
$this->_response->setBody(file_get_contents($file_path));
$this->_response->sendResponse();
// where $file_path is your file path...
To make some streaming-like it's a bit harder the response must look something like that :
$this->_response->setHeader('Content-Type',mime_content_type($file_path));
$this->_response->setHeader('Connection','Keep-Alive');
$this->_response->setHttpResponseCode(206);
$this->_response->setHeader('Keep_Alive','timeout=15, max=98');
$this->_response->setHeader('Content-Length',filesize($file_path));
$this->_response->setBody(file_get_contents($file_path));
$this->_response->sendResponse();
To make real streaming you have to use the stream_context_create() option of file_get_contents and to accept header request to grab the offset of the file and passing it to the context.
Note that in php 5.3 you have better method based on PECL to check mime-type and other info for your file. And lastely having a function that check if the file exists and if it is readable is always a good idea.
That's it for my little contribution, hope it could be usefull for someone.