Looks good but a couple of small things occurred to me:
* In output() you've got a branch for for if ($filename === false). Rather than calling echo, you could set filename = 'php://output' and use the same fopen()/fwrite()/fclose() code.
* It's not critical but I'd like to see more comments in output() and createFromFile() on the file format.
* It appears that you've corrected just about everything Justin Patrin mentioned other than a couple of the "BM"s (rather than 'BM').