Advanced search  

News:

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

Pages: [1]   Go Down

Author Topic: CompressHTML (compress HTML output of CPG 1.4.x)  (Read 25166 times)

0 Members and 1 Guest are viewing this topic.

Timos-Welt

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 800
    • Timos-Welt
CompressHTML (compress HTML output of CPG 1.4.x)
« on: November 27, 2008, 07:22:23 pm »


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
Logged

Hein Traag

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: nl
  • Offline Offline
  • Gender: Male
  • Posts: 2166
  • A, B, Cpg
    • Personal website - Spintires.nl
Re: CompressHTML (compress HTML output of CPG 1.4.x)
« Reply #1 on: November 27, 2008, 08:36:36 pm »

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?
Logged

Timos-Welt

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 800
    • Timos-Welt
Re: CompressHTML (compress HTML output of CPG 1.4.x)
« Reply #2 on: November 27, 2008, 09:05:24 pm »

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

Hein Traag

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: nl
  • Offline Offline
  • Gender: Male
  • Posts: 2166
  • A, B, Cpg
    • Personal website - Spintires.nl
Re: CompressHTML (compress HTML output of CPG 1.4.x)
« Reply #3 on: November 27, 2008, 09:32:08 pm »

Good stuff Timos. Thanks.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: CompressHTML (compress HTML output of CPG 1.4.x)
« Reply #4 on: November 28, 2008, 07:48:46 am »

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]
« Last Edit: November 28, 2008, 09:38:16 am by Joachim Müller »
Logged

Hein Traag

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: nl
  • Offline Offline
  • Gender: Male
  • Posts: 2166
  • A, B, Cpg
    • Personal website - Spintires.nl
Re: CompressHTML (compress HTML output of CPG 1.4.x)
« Reply #5 on: November 28, 2008, 08:07:37 am »

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

Timos-Welt

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 800
    • Timos-Welt
Re: CompressHTML (compress HTML output of CPG 1.4.x)
« Reply #6 on: November 28, 2008, 10:38:01 am »

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.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: CompressHTML (compress HTML output of CPG 1.4.x)
« Reply #7 on: November 28, 2008, 10:48:34 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).
Logged

Timos-Welt

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 800
    • Timos-Welt
Re: CompressHTML (compress HTML output of CPG 1.4.x)
« Reply #8 on: November 28, 2008, 11:13:02 am »

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<=
Logged
Pages: [1]   Go Up
 

Page created in 0.028 seconds with 21 queries.