note 95225 deleted from function.base64-encode by danbrown
| From: | danbrown@php.net | Date: | Sat, 19 Dec 2009 21:21:30 +0000 |
| Subject: | note 95225 deleted from function.base64-encode by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-164139@lists.php.net to get a copy of this message | ||
Note Submitter: JT
----
Note that MitMacher's solution below can be more cleanly and efficiently expressed using a
stream filter, specifically convert.base64-encode:
$istream = fopen('foo.bar', 'rb');
$ostream = fopen('php://output', 'w');
stream_filter_append($ostream, 'convert.base64-encode', STREAM_FILTER_WRITE,
array('line-length' => 76, 'line-break-chars' => "\r\n"));
while (!feof($istream)) { fwrite($ostream, fread($istream, 4096)); }
fclose($istream);
fclose($ostream);
No need to reinvent.