JSmin for cpg1.5.x - speed up gallery access JSmin for cpg1.5.x - speed up gallery access
 

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

JSmin for cpg1.5.x - speed up gallery access

Started by Timos-Welt, January 14, 2010, 12:31:01 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Timos-Welt

What's this?
This plugin compresses javascript files and reduces their number without affecting functionality. The compressed files will be cached. Normally this plugin will make your gallery access faster for visitors. If you update your gallery or any plugins that add javascript stuff, it is very important to manually clear the cache using the button in plugin manager.
Using cpg1.5.x, many javascript files will be loaded by the visitor's browser. There are four files that will always be loaded on every page (jquery-1.3.2.js, scripts.js, jquery.greybox.js, jquery.elastic.js). More files will be loaded depending on the actual page and the plugins you have installed. As long as you're not logged in as administrator, this plugin does the following:

  • Step 1:
  • merge the four files that will always be loaded on every page to one javascript file (reduces number of HTTP requests to 1)
  • compress it using JSmin to remove comments and disposable spaces (reduces size by 10-15%)
  • if browser supports it and PHP with zlib support, compress it with gzip (reduces size by 50-70%)
  • cache the resulting file so compression has only to be done once (in folder plugins/jsmin/cache)
  • Step 2:
  • if exist, merge the rest of the javascript files on the current page to another file (reduces number of HTTP requests to 0 or 1)
  • compress this one using JSmin to remove comments and disposable spaces (reduces size by 10-15%)
  • if browser supports it and PHP with zlib support, compress it with gzip (reduces size by 50-70%)
  • cache the resulting file so compression has only to be done once (max cache size 500 KByte / 40 files)

How to install
1. Upload folder jsmin to your plugins folder.
2. The folder plugins/jsmin/cache must be readable by visitors via http, and it must be writable by php (usually chmod to 755).
3. Install via plugin manager.


How to uninstall
1. Uninstall via plugin manager.
2. Remove folder jsmin from your plugins folder.


Maintenance
If you ever update your gallery or any plugins that add javascript stuff, it is very important to manually clear the cache using the button in plugin manager.


Download
http://sourceforge.net/projects/coppermine/files/Plugins/1.5.x/cpg1.5.x_plugin_jsmin_v1.2.zip/download

=========================================================================


Change log:
-----------

v1.1 (2010/01/19)
-----------------
code clean up

v1.0 (2010/01/18)
-----------------
added new algorithm that has the optimal balance between
- few http requests (always exactly 2 per page)
- optimal compression
added docs
stable release

v0.4 (2010/01/16)
-----------------
Using new plugin hook (thanks Andre)
Added check if zlib is available in php for algo 5 + 6

v0.3 (2010/01/16)
-----------------
Added check if browser supports gzip encoding for algorithm 5 + 6

v0.2 (2010/01/15)
-----------------
added two new algorithms with gzip compression for browsers that support it

v0.1 (2010/01/14)
-----------------
First release.

Timos-Welt


Timos-Welt


Timos-Welt


papukaija

This plugin sounds promising but it removes the navigation arrows from the filmstrip. I can't post a link because I tested this with my local lamp. I removed all plugins except this one before testing and used the classic theme.

m4rcu5

Unfortunately this plugin does not work correctly with Lighbox. When activated the lightbox will not show up when clicking the image.
When disabled or removed everything works fine again.

Jarode

It makes image manipulation plugin doesn't work at all. :-[

Timos-Welt

Works perfectly here. Please post links to your galleries with installed plugin, then I'll have a look at it.

papukaija

Here's a link to my gallery. As you can see, there is now navigation arrows. I doubt if any of the javascript is working. The only installed plugin is your jsmin plugin, but all the default plugins are uploaded to the server.

My gallery is using rev 7558. The server automatically sends every ASCII mode file as compressed, but I tested with my local lamp that disabling automatic compression doesn't solve this issue.

Timos-Welt

Open codebase.php with a text editor and find this:

          // zlib there and browser supports it => suffix is now .js.gz
          $jsmin_suffix = '.js.gz';

and change to

          // zlib there and browser supports it => suffix is now .js.gz
          // $jsmin_suffix = '.js.gz';

Don't forget to clear the cache. This should make it work correctly.

regards
Timo

papukaija


Joachim Müller

A user has reported issues with this plugin in relation to a core functionality in the thread "Registed Users Creating albums".

cl9m

Hi,
I've found a probleme  :)  when this plugin is active Members can't upload with swfuploader but administator can upload.

grb

I installed this plugin, and everything appeared to work. But then I find the following:

I have high resolution, 640x480 resolution and thumbnails. I can see original resolution images, when I click on the picture itself. This is broken with this plugin:(
I uninstalled the plugin, or when I am logged in as admin - everything is normal.

Thanks

S.Gerard

Timos, I am planning on using your plug-in on the new version of our beats website, and am wondering if running my jscript in "noconflict" mode will cause any problems. Thanks in advance.

nelsonmclester

This plugin sounds promising but it removes the navigation arrows from the filmstrip. I can't post a link because I tested this with my local lamp. I removed all plugins except this one before testing and used the classic theme.
Expedia Coupons For Vacations.

mathewdeavers

Unfortunately this plugin does not work correctly with Lighbox. When activated the lightbox will not show up when clicking the image.
When disabled or removed everything works fine again.

Timos-Welt


Timos-Welt


Sweely

1000 boktips & bokrecensioner: 1MiljonBoktips.se - 1000 däcktest: Däckbanditen.se
Jämför takläggare: Tak365.se