ID: 15930 Updated by: [EMAIL PROTECTED] -Summary: gzencode can't have a level Reported By: [EMAIL PROTECTED] Status: Analyzed Bug Type: Documentation problem Operating System: windows 2000 PHP Version: 4.1.1 Assigned To: sr New Comment:
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. Previous Comments: ------------------------------------------------------------------------ [2002-03-07 11:41:43] [EMAIL PROTECTED] 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] [EMAIL PROTECTED] 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] [EMAIL PROTECTED] <?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