Gzip Compression Size.

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Wed Jul 26, 2006 8:45 pm    Post subject: Gzip Compression Size. Reply with quote

I've searched all over Google for this function or how to do it. All I get are these
tests showing you the uncompressed and compressed percentage of the page. I
want to know what these people use to perform these tests.

How do I get the compressed size of a Gzip page?
How do I get the uncompressed size of a Gzip page?

This will help me display a nice feature on my website on compressed Gzip
pages. I want people to be able to see Gzip in action!

Anyone who know's how to do this, please let me know. Thank You!

Sincerely, TRUSTAbyss
Back to top View user's profile Send private message Visit poster's website
pkSML
-


Joined: 29 May 2006
Posts: 955
Location: Michigan, USA

PostPosted: Wed Jul 26, 2006 9:58 pm    Post subject: Reply with quote

Unfortunately, I don't think you can get a realtime web browser stat for Gzip bandwidth savings.

The tests done that I've run into on the net show website content that Gzip compresses. They ran this operation independent of a webserver. They just use a program like Winzip that Gzip's the files (that would be none other than Gzip). You could do the test manually and display the savings page by page (compare original with Gzipped version), though.
_________________
Stephen
Need a LitlURL?


http://CodeBin.yi.org
Back to top View user's profile Send private message Visit poster's website
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Wed Jul 26, 2006 10:12 pm    Post subject: Reply with quote

It's possible!
http://www.gidnetwork.com/tools/gzip-test.php
Back to top View user's profile Send private message Visit poster's website
MonkeyNation
-


Joined: 05 Feb 2005
Posts: 921
Location: Cardiff

PostPosted: Wed Jul 26, 2006 10:28 pm    Post subject: Reply with quote

Uh, download the gzip'ed page then decompress it and compare the sizes.

I think you'll have to write out the HTTP request manually rather than use file_get_contents or something, but other than that it shouldn't be hard.
_________________
Back to top View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger ICQ Number
AbyssUnderground
-


Joined: 31 Dec 2004
Posts: 3855

PostPosted: Wed Jul 26, 2006 10:34 pm    Post subject: Reply with quote

Download a file with file_get_contents, save to a text file, get the size of the text file, and thats your uncompressed size :-)
_________________
Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk
Back to top View user's profile Send private message Visit poster's website
MonkeyNation
-


Joined: 05 Feb 2005
Posts: 921
Location: Cardiff

PostPosted: Wed Jul 26, 2006 10:52 pm    Post subject: Reply with quote

AbyssUnderground wrote:
Download a file with file_get_contents, save to a text file, get the size of the text file, and thats your uncompressed size :-)


You would still need the response headers to know if it was gzip'ed in the first place or not, because as far as I know PHP will automatically decompress it.

Edit: That, or not send a header to say that it accepts gzip compression.
_________________
Back to top View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger ICQ Number
pkSML
-


Joined: 29 May 2006
Posts: 955
Location: Michigan, USA

PostPosted: Sat Jul 29, 2006 12:53 am    Post subject: Reply with quote

I have found a way to show real-time bandwidth savings by using G-zip. It is an approximation, and needs an external PHP file to do the work. The PHP file is requested. It displays the content (that is sent gzipped) and displays the bandwidth savings at the bottom.

Is anyone interested in this?
--------------------------
I believe this is what TRUSTAbyss was referring to.
TRUSTAbyss wrote:
This will help me display a nice feature on my website on compressed Gzip pages. I want people to be able to see Gzip in action!

_________________
Stephen
Need a LitlURL?


http://CodeBin.yi.org
Back to top View user's profile Send private message Visit poster's website
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Thu Aug 17, 2006 12:57 pm    Post subject: Reply with quote

Yes! That's exactly what I want.
Back to top View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group