CompressHTML (compress HTML output of CPG 1.4.x) CompressHTML (compress HTML output of CPG 1.4.x)
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

CompressHTML (compress HTML output of CPG 1.4.x)

Started by Timos-Welt, November 27, 2008, 07:22:23 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Timos-Welt


What's this?

This plugin compresses the HTML output by removing disposable spaces and line feeds from the source code. It is meant for those who can't use zlib compression in their PHP settings to compress the gallerie's output (which is much more effective), or for those who want to make their source code more difficult to read. Under certain conditions it may be useful for people on slow connections (modem, GPRS etc); people on fast connections will most probably not notice any difference, because page load time and additional calculation time will reciprocative even out in this case.
The reduction in page size is 15-30% depending on which page of the gallery is visited, your CPG theme and the amount of plugins and extras used. You can check how much it saves on your CPG - have a look at the last line of the page source code when the plugin is installed (don't forget to log off - the plugin will not work in admin mode).


PLEASE READ THIS PARAGRAPH CAREFULLY!!!


  • This plugin MUST be the last one in the chain. Move it all the way down in plugin manager, otherwise it may make other plugins stop working.
  • This plugin may break certain scripts, especially javascripts with missing semicolons after each command. If it doesn't work, edit codebase.php with a text editor and comment out the marked line or delete it.
  • This plugin may under certain conditions lead to invalid X(HTML), so if you're after that, re-check with a validator. If it doesn't work, edit codebase.php with a text editor and comment out the marked line or delete it.
  • This plugin will not have any effect as long as you're in admin mode. Log off to see it working.
  • NEVER EVER ask for support on the CPG forums when this plugin is active. Supporters will probably refuse to help you because of the unreadable source code. Uninstall the plugin before asking for support.


How to install

1. Upload folder compresshtml to your plugins folder.
2. Install via plugin manager.


How to uninstall

1. Uninstall via plugin manager.
2. Remove folder compresshtml from your plugins folder.


Demo gallery

Click here and look at the page source code

regards
Timo

Hein Traag

Timos, yet another nice plugin from your hand but i do have one question. You mention that supporters will probably not help out due to unreadable source code. Would it be possible to exclude the line which says what version is used from the scrambling proces?

Timos-Welt

Show the source code and scroll all the way to the right - there it is (and it's always there).

Hein Traag


Joachim Müller

#4
Good work, although I don't get the point: in a photo gallery, the bandwidth get's eaten up by the images embedded into the gallery's output. The textual output is neglible compared to the amount of http traffic that get's triggered by the embedded images. Therefor, I can hardly see the point in compressing the ouput that way. Scrambling the source code is a very "nineties" idea IMO as well, as it will only fool newbies, especially if the user plays by the rules and doesn't try to remove the "Powered by Coppermine" tag - that tag can be used to find out that the used app is not a secret.

[off topic]
Hein, you can always browse the sql folder or the docs folder if you want to find out which version a particular gallery is using, especially if they are trying to cloak the output of version information. If someone says his gallery is located at http://example.com/coppermine_folder/, then just go to http://example.com/coppermine_folder/sql/update.sql or http://example.com/coppermine_folder/docs/index.htm and the version that user has will shine through.
Dang, now I told one of my supporter secrets ;)
[/off topic]

Hein Traag

 ;) i'll keep the secret to myself. Good point though about the sql folder.

Timos-Welt

To be honest, I think this plugin is absolutely useless for anyone with decent webspace, because zlib compression via PHP.INI or server settings is much more effective (and much faster). I already wrote that in the opening posting.

This plugin is really useful for plugin developers and theme creators IMO, and that's what I wrote it for originally. If it is installed and your theme is still valid HTML, your scripts still work correctly etc., then you know that you have done something right.

Joachim Müller

Quote from: Timos-Welt on November 28, 2008, 10:38:01 AM
This plugin is really useful for plugin developers and theme creators IMO, and that's what I wrote it for originally. If it is installed and your theme is still valid HTML, your scripts still work correctly etc., then you know that you have done something right.
Good point. That's actually something I can applaud: if your custom JavaScript breaks by using the plugin, you have made a mistake creating your JavaScript (usually missing brackets or semicolons).

Timos-Welt

It's not only about javascript.

My private gallery http://pics.timos-welt.de is valid XHTML 1.0 as long as the plugin is not installed. When installed, it's not valid anymore - though the site works fine. I have absolutely no idea yet why; blanks and line feeds should have absolutely no influence on the validity of a web page, but in real world, they do. Fascinating, isn't it? ;D

BTW: Enabling zlib compression in PHP.INI could speed up this forum a lot and save massive bandwidth. =>Link<=