Bug #15930 Updated: gzencode can't have a level

From: Date: Thu, 07 Mar 2002 18:04:09 +0000
Subject: Bug #15930 Updated: gzencode can't have a level
References: 1  Groups: php.bugs php.doc 
Request: Send a blank email to php-bugs+get-1940@lists.php.net to get a copy of this message
ID: 15930 Updated by: jbgagnon@apic.fr -Summary: gzencode can't have a level Reported By: jbgagnon@apic.fr Status: Analyzed Bug Type: Documentation problem Operating System: windows 2000 PHP Version: 4.1.1 Assigned To: sr New Comment: Well, I prefer the fonctionnality in documentation or something like : gzencode($data[,$level[,$mode]]) It would be much easy to use, than make a gzip by hand with header,crc, ... in "User Contributed Notes" two another persons report this problem. We can perhaps ask them. Previous Comments: ------------------------------------------------------------------------ [2002-03-07 12:42:03] sr@php.net Z_DEFAULT_COMPRESSION is a constant of the zlib include file, so you could change it only with a recompile of php. As a workaround maybe you can use gzdeflate() or gzcompress(), there the second parameter is the compression level. But then you have to manually add the gzip headers (and maybe the CRC) if you need them. ------------------------------------------------------------------------ [2002-03-07 11:41:43] jbgagnon@apic.fr YES, I use it. before I use gzopen($fic,"wb9"); with a temporary file the compression was better than gzencode. For passing information from serveur to client, the size of data is very important. I prefer spending 20 ms for much compression than 30 sec more for download. but if it is possible to change the Z_DEFAULT_COMPRESSION, it's ok I always use the same (maxi) compression. ------------------------------------------------------------------------ [2002-03-07 10:50:54] sr@php.net That's an error in the documentation. The optional second parameter doesn't set the compression level, it does set the compression mode, i.e. you can use FORCE_GZIP or FORCE_DEFLATE in order to use gzip/deflate compression. The compression level is always the default Z_DEFAULT_COMPRESSION. If nobody objects (does anybody use this parameter?) I'll fix the documentation ... ------------------------------------------------------------------------ [2002-03-07 07:37:05] jbgagnon@apic.fr <?php $data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; $gzdata = gzencode($data); echo strlen($gzdata),":ok<BR>"; $gzdata = gzencode($data,9); echo strlen($gzdata),":bad always 10<BR>"; ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=15930&edit=1

« previous php.bugs (#1940) next »