note 36909 added to function.ob-gzhandler

From: Date: Mon, 27 Oct 2003 07:05:16 +0000
Subject: note 36909 added to function.ob-gzhandler
Groups: php.notes 
Request: Send a blank email to php-notes+get-59353@lists.php.net to get a copy of this message
So much code...here's a lighter/faster one: <?php if ( $do_gzip_compress ) { $gzip_size = ob_get_length(); $gzip_contents = ob_get_clean(); // PHP < 4.3 use ob_get_contents() + ob_end_clean() echo "\x1f\x8b\x08\x00\x00\x00\x00\x00", substr(gzcompress($gzip_contents, 9) - 4), // substr -4 isn't needed pack('V', crc32($gzip_contents)), // crc32 and pack('V', $gzip_size); // size are ignored by all the browsers i have tested } exit; ?> I wouldn't recommande using level 9, waste of CPU, something between 1 and 6 would be more resonable I have tested without the substr/crc/size and it worked flawlessly in IE5/5.5/6, Opera7.11/7.21, IE5.5 MAC ---- Manual Page -- http://www.php.net/manual/en/function.ob-gzhandler.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+36909 Delete -- http://master.php.net/manage/user-notes.php?action=delete+36909&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+36909&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#59353) next »