summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2014-12-04 10:30:32 +0100
committerAndrey Andreev <narf@devilix.net>2014-12-04 10:30:32 +0100
commita94c397768c5906e0e519dc5b473d0688048caaa (patch)
tree9b0f659cc6fa6f67cb18acb49087fff7e138a69a /system
parentdfcca20182d608f68f56a6129cc57b41503244d9 (diff)
parentd187847cd09eaacb881ddebe74416fdfa7a6ead9 (diff)
Merge pull request #3341 from garrettair/gzcompress-arguments
Adds Compression options to Zip Library
Diffstat (limited to 'system')
-rw-r--r--system/libraries/Zip.php15
1 files changed, 14 insertions, 1 deletions
diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php
index 434229471..5208c9149 100644
--- a/system/libraries/Zip.php
+++ b/system/libraries/Zip.php
@@ -95,6 +95,19 @@ class CI_Zip {
* @var int
*/
public $now;
+
+ /**
+ * The level of compression. 0 to 9, 9 being the highest level of
+ * compression.
+ * @var int
+ */
+ public $compression_level = 6;
+
+ /**
+ * Which encoding to use. One of the ZLIB_ENCODING_* constants.
+ * @var int
+ */
+ public $compression_encoding = ZLIB_ENCODING_DEFLATE;
/**
* Initialize zip compression class
@@ -248,7 +261,7 @@ class CI_Zip {
$uncompressed_size = strlen($data);
$crc32 = crc32($data);
- $gzdata = substr(gzcompress($data), 2, -4);
+ $gzdata = substr(gzcompress($data, $this->compression_level, $this->compression_encoding), 2, -4);
$compressed_size = strlen($gzdata);
$this->zipdata .=