Page 1 of 1
Web page size retrieval
Posted: Thu Mar 25, 2004 10:25 am
by pickle
Hi All,
Is there a quick and easy, or at least somewhat simple, way to get the total size of a web page, images and all? I'm working on a number of website front ends for the organization I work for, and I want to see how big each front end ends up being?
The only plans I had so far was to get the size of the html, retrieve it, parse it, then get the file size of every image tag. Is this how it has to be done? Thanks.
-Dylan
Re: Web page size retrieval
Posted: Thu Mar 25, 2004 10:49 am
by TheBentinel.com
pickle wrote:Hi All,
Is there a quick and easy, or at least somewhat simple, way to get the total size of a web page, images and all? I'm working on a number of website front ends for the organization I work for, and I want to see how big each front end ends up being?
-Dylan
It sounds like you're looking for a programmatic way, and I think the long and drawn out method is your only choice on that one. Even the server that serves up the HTML doesn't know how big the overall page will be, since it may not host all the images and such.
But, if you don't mind doing a little manual work, you can save the page (in Internet Explorer) as a web archive (File-->Save As-->Save as Type = Web Archive (*.mht)) and then check the size of that file. It pops in some MIME overhead, but it would give you a good idea of the size of the overall page, images and all.
Re: Web page size retrieval
Posted: Thu Mar 25, 2004 11:02 am
by pickle
TheBentinel.com wrote:
But, if you don't mind doing a little manual work, you can save the page (in Internet Explorer) as a web archive (File-->Save As-->Save as Type = Web Archive (*.mht)) and then check the size of that file. It pops in some MIME overhead, but it would give you a good idea of the size of the overall page, images and all.
Sounds like a plan. Thanks.
Posted: Thu Mar 25, 2004 1:02 pm
by Roja
Out of curiosity - if you do output buffering in the page, does it include the pictures in the size?
If so, thats a solution. If not, perhaps get the output buffer (ob_*) size, and then add the image sizes with a file system check.
Re: Web page size retrieval
Posted: Thu Mar 25, 2004 1:24 pm
by aleigh
pickle wrote:Hi All,
Is there a quick and easy, or at least somewhat simple, way to get the total size of a web page, images and all? I'm working on a number of website front ends for the organization I work for, and I want to see how big each front end ends up being?
The only plans I had so far was to get the size of the html, retrieve it, parse it, then get the file size of every image tag. Is this how it has to be done? Thanks.
-Dylan
Take a look at Snoopy, which is a handy implementation of a web client. The strategy you probably want to look at is to download the HTML, find the IMG tags, and then at least request them from the server and hope that it provides you Content-length in the response.
There is no guarantee that Content-length will be provided, in which case you have to download the entire image and see how big it turned out to be.