|
brian - 2011-05-21 02:52:09
Hi,
this is a good package, the only thing lacking now is the ability to open
its zip files in mac. I have read somewhere that its due to some bit3 that
is set in the header file: (reference link :http://stackoverflow.com/questions/5573211/dynamically-created-zip-files-by-zipstream-in-php-wont-open-in-osx)
I have tried adjusting these settings in the zipstream.php file for gzType as well as
the "version needed to extract" entries, but have not been able to solve the problem.
Any tips on how I can do this?
Thanks,
Brian
Asbjorn Grandt - 2011-05-21 07:16:18 - In reply to message 1 from brian
Thanks for pointing it out to me, I'll see if I can figure it out.
Asbjorn Grandt - 2011-05-21 08:27:26 - In reply to message 2 from Asbjorn Grandt
I checked my ZipSteam, it creates an archive with version number 0x0014 (50 4b 03 04 14 00), the same as the InfoZip command line program.
The ZipStream referred to in the article you mentioned is a different implementation, not mine. However both versions uses the GZ deflate, so the version number must be 2.0, or decimal 20 in the file, thus you get OS=0x00 Zip=0x14.
Can your OSX open this zip file?
grandt.com/tempdata/ZipStreamExampl ...
Apart from a few changes in function names (add_file becomes addFile etc. the two seem to be more or less the same)
But if you change his array('v', (6 << 8) + 3) to just array('v', 20) in the two "# version needed to extract" lines, it should work the same as InfoZip.
brian - 2011-05-21 14:25:28 - In reply to message 3 from Asbjorn Grandt
Hi,
I'm sorry but the zip file does not open with archive utility, the default
archive software that ships with Mac osx. I would really like it to be able
to do so.
And i can't seem to find array('v', (6 << 8) + 3) anywhere in the zipstream.php code?
Brian
Asbjorn Grandt - 2011-05-21 16:35:51 - In reply to message 4 from brian
Sorry, I was referring to the ZipStream referenced in the question link you provided in your first post.
Try the zip I linked before again, I uploaded another version, just to test it.
If it works, you should only have to modify these two lines in the buildZipEntry function in my class:
$zipEntry .= "\x14\x00"; // Version needed to extract
and
$cdEntry .= "\x14\x00"; // Version Needed to extract
by replacing \x14 with \x0A
You might also want to modify this line in the same function:
$cdEntry .= "\x00\x00"; // Made By Version
to
$cdEntry .= "\x0A\x00"; // Made By Version
brian - 2011-05-22 07:39:28 - In reply to message 5 from Asbjorn Grandt
Sorry, but it still does not work.
I myself have tried many combinations, but probably do not know what i am doing
and therefore can't solve it. I was referencing "zip file structure" from wiki and looking
around with a hex editor.
The one from infozip seems to have 0 values for CRC32, compressed size, and uncompressed
size entries.
Brian
Asbjorn Grandt - 2011-05-22 08:02:37 - In reply to message 6 from brian
"The one from infozip seems to have 0 values for CRC32, compressed size, and uncompressed size entries."
Then the InfoZip is invalid, the only entry that can have a 0 size and CRC are directory entries. Files must have both compressed and uncompressed sizes and CRC. The sizes will be the same if the content is "stored".
If you take the Zip file I provided, unpack it and then repack it with your version of InfoZip, will that work in the Mac archiver? If it does, please upload that zip to for instance Mediafire, so that I can look at it.
I am starting to guess that it is not the zips that are at fault, but the Mac Archive tool, and it is not feasible for this script to have to tweak it's output to fit every faulty Zip implementation.
To the best of my knowledge, the Zips I provided, and are produced by ZipStream are structurally valid. Neither InfoZip or the zipinfo tools are giving any warnings.
Adam Docherty - 2011-06-30 21:20:50 - In reply to message 7 from Asbjorn Grandt
"I am starting to guess that it is not the zips that are at fault, but the Mac Archive tool, and it is not feasible for this script to have to tweak it's output to fit every faulty Zip implementation."
I hear where you are coming from, but really for this script to be feasible it needs to be compatible with Mac as well otherwise if I use it on my website many, many people are not going to be able to open the archives. Soooooo Please Please Pretty Please, get her working with mac!!!!
Asbjorn Grandt - 2011-07-01 02:39:04 - In reply to message 8 from Adam Docherty
I'll give it another try over the weekend.
Adam Docherty - 2011-07-01 15:09:13 - In reply to message 9 from Asbjorn Grandt
That sounds great buddy! I am not sure if this helps, but I use a utility on mac called yemuzip to create archives that are compatible in both mac and pc - I have zipped up an example archive in the application and made it available here so you can compare.
seerit.com/helloworld.zip
Thanks again!
|