...

View Full Version : compressing, buffering and ob_get_length



looka
08-24-2006, 12:51 AM
i am using output buffering:

ob_start('ob_gzhandler')


and at the end i get the data length by calling:

header('Content-length:'.ob_get_length()):


but i have a problem: this is size of UNCOMPRESSED data, but i should send only compressed data length. any idea how to fix it?

thanx!

marek_mar
08-24-2006, 02:38 AM
ob_start()
ob_start('ob_gzhandler');
// content and whatnot;
ob_end_flush();
header('Content-Length: ' . ob_get_length());
ob_end_flush();

... is one alternative.

looka
08-24-2006, 09:32 AM
why to use ob_end_flush twice?
calling this function sends data to user and destroys buffer, so the second call is useless...

anyway, you still used the same method as me - user gets length of uncompressed data :(

marek_mar
08-25-2006, 01:39 AM
why to use ob_end_flush twice?
I was pulling you leg. I would never post code that I suspect of being correct.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum