-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Better Compression of ZPK #9
Comments
It seems that using the php zip extension does not allow setting of compression level. See this |
add external binaries to the package - is it an option? On Tue, Oct 1, 2013 at 11:17 AM, slaff notifications@github.com wrote:
|
7zip is providing the best zip compression, as far as I know, and it would be great if there was binary in every major OS. Unfortunately that is not the case. What I can think of is to use the "zip" command under Linux/MacOS X if it is available and fallback to the PHP Zip extension if it is not. (The best will be to improve the PHP zip extension but that is way off the purpose of this project. ). |
Nice - 7zip has unofficial ports for all our supported systems, so we can Fixing PHP-ZIP can be nice, if its only implementing compression flags and Zvika On Tue, Oct 1, 2013 at 12:43 PM, slaff notifications@github.com wrote:
|
I think looking for system zip and falling back is best option. Many installations also won't have ext/zip Sent from my iPhone
|
Low priority, to be sure, but I think this is possible now. Am I looking at this correctly? |
@clarkphp I've tried using different compression algorithms and compression levels. But strangely enough the length of the final zip file was always the same. Here is my initial test script: <?php
$zip = new ZipArchive;
$res = $zip->open('/tmp/test.zip', ZIPARCHIVE::CREATE | ZipArchive::OVERWRITE);
if ($res === TRUE) {
$files = [
'x.php',
'y.php',
'z.php',
// .. more files were used in actual tests....
];
foreach($files as $file) {
$zip->addFile(__DIR__ .'/data/'.$file, $file);
// $result = $zip->setCompressionName($file, ZipArchive::CM_REDUCE_4); // same result as NOT setting the compression
// $result = $zip->setCompressionName($file, ZipArchive::CM_DEFLATE); // <- did not work for me
// $result = $zip->setCompressionName($file, ZipArchive::CM_BZIP2, 9); // same result as NOT setting the compression
if($result) {
die('Unable to set compression level!');
}
}
$zip->close();
echo 'ok';
} else {
echo 'failed';
} Using CM_REDUCE_4 or, CM_BZIP2 with compression 9 did't make even a single byte difference for the final test.zip file. I am using Zend Server's PHP 7.4. |
No description provided.
The text was updated successfully, but these errors were encountered: