Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Compressing Pages


spooks

Recommended Posts

This may be placed elswhere but I could'nt find it in this version.

 

This dead simple mod compresses pages at the server as they delivered to the client browser (if it supports compression) using gzip.

 

It can give upto 80% reduction in size, so speed download, there is no extra load to server.

 

There is a option in admin, so if you have that 'on' don`t apply this to the client side.

 

This can be done for any php document.

 

In application_top.php both on client side & admin, near the top, after <?php

 

add:

 

ob_start("ob_gzhandler");

 

Thats it, you should notice a speed increase on loading admin pages immediatly, client pages will be faster, especially if using dial-up.

 

I have`nt found any downside to date.

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

  • Replies 80
  • Created
  • Last Reply
which browsers don't support gzip?

 

IE 3 & older, Opera 4 & older Netscape 3 & older, and certain versions of firefox (not sure which)

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

I already have this in my version of MS2.2

 

// if gzip_compression is enabled, start to buffer the output
if ((GZIP_COMPRESSION == 'true') && ($ext_zlib_loaded = extension_loaded('zlib')) &&
(PHP_VERSION >= '4')) {
if (($ini_zlib_output_compression = (int)ini_get('zlib.output_compression')) < 1) {
	if (PHP_VERSION >= '4.0.4') {
		ob_start('ob_gzhandler');
	} else {
		include (DIR_WS_FUNCTIONS . 'gzip_compression.php');
		ob_start();
		ob_implicit_flush();
	}
} else {
	ini_set('zlib.output_compression_level', GZIP_LEVEL);
}
}

Link to comment
Share on other sites

I already have this in my version of MS2.2

 

// if gzip_compression is enabled, start to buffer the output
if ((GZIP_COMPRESSION == 'true') && ($ext_zlib_loaded = extension_loaded('zlib')) &&
(PHP_VERSION >= '4')) {
if (($ini_zlib_output_compression = (int)ini_get('zlib.output_compression')) < 1) {
	if (PHP_VERSION >= '4.0.4') {
		ob_start('ob_gzhandler');
	} else {
		include (DIR_WS_FUNCTIONS . 'gzip_compression.php');
		ob_start();
		ob_implicit_flush();
	}
} else {
	ini_set('zlib.output_compression_level', GZIP_LEVEL);
}
}

 

 

Hi, I did mention the option in admin, which controls this bit of code, the point of this tip is to make people aware of this very handy option & how to apply it in admin as well, or any other php pages.

 

Try it on your admin & see just how much quicker they load.

 

;)

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

Hey Spooks, thanks. Have seen that option for yonks but never touched it till now. I think load times have halved and I am using the default value of 5..

Link to comment
Share on other sites

What does the unsupported browsers show when using this?

 

Thay wont show any differance, the server will detect the browser does'nt support compression, so will serve uncompressed pages, so the only differance will be the load speed.

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

Thay wont show any differance, the server will detect the browser does'nt support compression, so will serve uncompressed pages, so the only differance will be the load speed.

 

Interesting. Thanks for the information.

Link to comment
Share on other sites

I am sorry, I donot get clear myself. Hope somebody can help me out.

 

in admin >Configuration >GZip Compression, if i set to "ture" and the level to "3",

 

can i still add "ob_start("ob_gzhandler");" in catalog/ admin/includes/application_top.php and catalog/incule/application_top.php

 

i just confuse i have got speed up in admin after add ob_start("ob_gzhandler");" in catalog/ admin/includes/application_top.php.

 

Anything i have done wrong?

Link to comment
Share on other sites

I am sorry, I donot get clear myself. Hope somebody can help me out.

 

in admin >Configuration >GZip Compression, if i set to "ture" and the level to "3",

 

can i still add "ob_start("ob_gzhandler");" in catalog/ admin/includes/application_top.php and catalog/incule/application_top.php

 

i just confuse i have got speed up in admin after add ob_start("ob_gzhandler");" in catalog/ admin/includes/application_top.php.

 

Anything i have done wrong?

 

If you set to true as above then yes still add to catalog/ admin/includes/application_top.php as that setting has no effect on the admin side, but do not add to catalog/includes/application_top.php as that would generate an error & is not then required anyway.

 

I hope that makes it clearer.

 

:)

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

If you set to true as above then yes still add to catalog/ admin/includes/application_top.php as that setting has no effect on the admin side, but do not add to catalog/includes/application_top.php as that would generate an error & is not then required anyway.

 

I hope that makes it clearer.

 

:)

 

Thanks Sam very much, your answer make me clear, i did find error when i add to catalog/includes/application_top.php. I really hope i can speed up the client side. :rolleyes:

Link to comment
Share on other sites

  • 2 weeks later...

Hello.

 

Can anyone assist me why my website (www.firstalberta.com) is taking too long time to load the first page/time ?

 

I applied all suggestions as stated above like turn on GZIP and reduce the image size too.

 

Please let me know how to tune, it is taking nearly 30 to 40 sec's and i need to load the page in 1 sec.

 

--

Thanks in Advance,

Kart.

Link to comment
Share on other sites

Hello.

 

Can anyone assist me why my website (www.firstalberta.com) is taking too long time to load the first page/time ?

 

I applied all suggestions as stated above like turn on GZIP and reduce the image size too.

 

Please let me know how to tune, it is taking nearly 30 to 40 sec's and i need to load the page in 1 sec.

 

--

Thanks in Advance,

Kart.

get a faster internet connection, loaded in 3 secs for me.

Link to comment
Share on other sites

Sam - Thank you!!!!! Wonderful Tip and just what I was looking for!

 

- Marlo

Dance as if No One were Watching ~ Sing as if No One were Listening ~ And Live Life everyday as if it were Your Last!

Link to comment
Share on other sites

Tulip/Kart - refresh your browser. Loaded quickly for me too....

 

- Marlo

Dance as if No One were Watching ~ Sing as if No One were Listening ~ And Live Life everyday as if it were Your Last!

Link to comment
Share on other sites

Hello.

 

Can anyone assist me why my website (www.firstalberta.com) is taking too long time to load the first page/time ?

 

I applied all suggestions as stated above like turn on GZIP and reduce the image size too.

 

Please let me know how to tune, it is taking nearly 30 to 40 sec's and i need to load the page in 1 sec.

 

--

Thanks in Advance,

Kart.

Your header graphic is 125KB and your total page is HUGE, including those products under "new Products." YOu really should use multiple product images, as big product pictures take forever to load and even longer to squish. Chechout the multipcs contrib.

Link to comment
Share on other sites

Try enabling page parse time so you can see how long your server is taking to set up the page.

 

If you want one sec, get rid of all those pics & flash at least.

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...