PHP5 - Create zip files - archive only, do not compress
Discuss Create zip files - archive only, do not compress in the PHP Development forum on Dev Shed. Create zip files - archive only, do not compress PHP Development forum discussing coding practices, tips on PHP, and other PHP-related topics. PHP is an open source scripting language that has taken the web development industry by storm.
Posts: 1,490
Time spent in forums: 3 Weeks 3 Days 19 h 21 m 45 sec
Reputation Power: 831
PHP5 - Create zip files - archive only, do not compress
Hello,
I have to send a collection of some files (number can range from 20-100) to users. PHP has the zip file functions for the purpose; well and good.
Problem is, most of those files will be jpeg's (which is a compressed format). As i see it, it doesn't make sense in compressing a compressed file which results in no-compression or negligible-compression; it is a waste of time and resources.
So, is there any way to disable the compression part? Just create the archive by grouping all the files but do not compress.
Thank you.
__________________
Why do we always seek someone, something or some thought? Are we afraid of ourselves?
Posts: 1,490
Time spent in forums: 3 Weeks 3 Days 19 h 21 m 45 sec
Reputation Power: 831
Quote:
Originally Posted by PradeepKr
explore apache settings
Code:
<IfModule mod_deflate.c>
SetOutputFilter DEFLATE
# file-types indicated will not be compressed
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png|rar|zip|pdf)$ no-gzip dont-vary
<IfModule mod_headers.c>
Header append Vary User-Agent
</IfModule>
</IfModule>
That, i assume will be helpful when i am delivering the zip files. I want to disable compression while "creating" the files using the ZipArchive() class of php.
Posts: 1,490
Time spent in forums: 3 Weeks 3 Days 19 h 21 m 45 sec
Reputation Power: 831
There is a constant, ZIPARCHIVE::CM_STORE. It is read only as of now; useful for determining the compression method of an existing zip file. It is not possible to use it while creating a zip file.
Posts: 10
Time spent in forums: 1 h 46 m 20 sec
Reputation Power: 0
I use B1 archiver for that. Just when choosing compression mode I opt for "Store" mode. In that case files do not get actually compressed but only stored together.