question about ob_get_length()
I have been redoing my site offline as it was taking way to long to load with the images. When I echoed ob_get_length() at the end of the page it says the page size was '63315' I took it this is the total size of the page, So I reduced the images in size to half and still it shows a very large size '61867'
My question is, is ob_get_length() showing the total buffer including the images ? or just the HTML code ?
Also when I view the site in Firefox it shows say '61867' but in IE it is not showing the same figure, even thought the page content is exactly the same. Does IE INCREASE the size or something as the figure is LARGER. But not by much, but still LARGER.
I have tried to read up on this on PHP.net but it does not seem to show very much about this function/command. Googling only answered me that the figure was in bytes. Not sure where to find out more about this one.
Can anyone shed some more light about this for me please.
Images are served via http request from the client to remote image, not from the PHP code (unless your PHP code is a script of type image). So images are fetched after the browser retrieves the page source, and then it goes out and remotely fetches anything in img tags or in the CSS that's an image type.
ob_get_length is showing the total number of bytes in the output string, and does not do anything to read external images. So no, adjusting the image size won't affect the size of the output string. The only exception there would be if you use a data uri scheme with the img src, so you actually give it the base64 encoded binary of the image. That would affect the size of the output buffer.
Ok I understand how that side works now. Thanks
I right clicked my page and saved it to a folder on my desktop and the file size of the html code is 70.4kb.
I then removed my categories menu and checked the size and this time is was 40kb.
Obviously the menu has to be condensed somehow. I have copied it from ebays menu and removed a load that were not relevant, but still it used just under half the size of the resulting HTML code that the browser gets.
My category menu is very much like ebay and opens up the sub menu when the main category is clicked. a lot of JS to perform that. Had someone code this for me some time ago. But now it seems that it is too large for what I need it to do. I think it is only good for smaller menus.
What other (methods/example site) could I use apart from having the page refresh each time the menu is clicked, so it then shows the sub categories.
I am wanting to have the site downgrade for visitors that choose to turn off JS. So looking for very little JS and if it is needed allow the page to downgrade without losing the usability of the site.
|All times are GMT +1. The time now is 05:41 AM.|
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.