Lightbox and Coppermine plugins
Edit: Due to hassles and constant updates required to Coppermine I’ve given up with it so the example photo below won’t show up any more. However the article should still be valid although I am not updating it for any future changes to Coppermine.
I’ve been finding it a struggle to get photos embedded in a page with a set layout such as a Wordpress blog. One option is to change the layout but another is to instead have the photos appear on top of the page instead thus releasing them from the constraints of the layout.
Such a solution is available in the form of Lightbox JS. I then discovered this script has been wrapped up in a Wordpress plugin, Lightbox JS Wordpress Plugin. Further to this there is a modification of this script to allow the photos to be scaled to the browser display with an option to view at full size, as in the Lightbox Plus Wordpress Plugin.
I have in the meantime been linking in my images from my Coppermine Gallery using the Coppermine Plugin, but this just links to Coppermine when clicking on thumbnails, so I’ve made a couple of modifications to make the plugin optionally use Lightbox.
As an example, here’s a photo to try out…
[cpg_imagefixthumb:1472]
Click on the image for a larger photo.
Modifications to the Coppermine Plugin (this is a diff view between the original and my changes)
Click here to download the modified plugin (you will need to edit the file and configure the database settings).
Essentially I’ve added an additional mode called ‘lightbox’ to CPGSC_SINGLEIMAGE_LINK and modified where this is used. I’m not sure if this will work for album views, probably not.
Note that I’ve also made another modification to the plugin to display a copyright message beneath photos when viewed in ‘normal’ mode, but this is optional and not currently being used in lightbox mode.








Would you be willing to post for download a copy of your updated plugin? I tried followed the changes… but so far failed 3 times.
Sorry for the delay. Yeah, I’ve just added a link to a download of the modified plugin. You can get it here:
http://www.sirjohn.co.uk/blog/wp-content/copperminesc.txt
You need to edit it to add your database details as usual. Note that this is based on 0.4.3. I haven’t updated to 0.4.5.
Hi Tim,
this is exactly what I was searching for. By accident I found your site and your plugin! Do I need to install lightbox plus or lightbox js ??? I didn’t really understand what you meant…
I use WP 2.0.4 and coppermine 1.4.4.
Cheers, Anja
I used the Lightbox Plus Plugin but it should work with either. It just depends whether you want the extra features of the ‘plus’ version. The modifications to the Coppermine plugin just simply uses the “rel=’lightbox’” attribute in links which is what triggers lightbox when you click on an image.
Another question: Is it working with lightbox 2 (vs.0.6.2)? There are many different versions, can you please say which one works with coppermine 1.4.4?
Hi Tim, thanks for the quick answer. I saw your answer after my second message
I now tried 6 different lightbox versions (lightbox2, lightbox2.02, wp-lightbox05plus, wp-lightbox062, wp-lightboxJS_latest, wp-lightbox-Plus-latest) but none of them let your modified coppermine script work. It worked for all other photos on my blog, but not the ones, that are linked to my gallery with code in the post like: [cpg_image:60,picname.jpg]. On a click, lightbox loads and never stops loading…strange…I almost had it…any idea? Hmm…would be so nice to get it to work…
The version of Pightbox Plus I’m using is 0.3 which I got from here…
http://zeo.unic.net.my/notes/wp-lightbox-plus-wordpress-plugin/
To get lightbox to work with the coppermine modifications you need to make sure the coppermine script is defined for lightbox…
define (’CPGSC_SINGLEIMAGE_LINK’, ‘lightbox’);
Also I probably haven’t got it working for all the methods the coppermine plugin supports. It works if I use thumbnail links direct to the image ID in coppermine, e.g.
[cpg_imagefixthumb:1507]
It probably needs work for some other methods though I though it should work for cpg_image. Needs some investigation, though maybe Brad who wrote the coppermine plugin can get lightbox working officially in his next version.
Hi Tim,
Will let you know if it works or not.
thanks for your tips, I’ll give it a new try
How and where to find the permanent image ID in coppermine though?
If you view an image in Coppermine with the file information shown you should get a URL field in the file information, something like this…
http://www.sirjohn.co.uk/gallery/displayimage.php?pos=-1507
The number on the right is the permanent ID (ignore the ‘-’).
It’s recommended to use the URL to link to images generally in case you move images around your gallery, as this URL is permanent so long as you don’t delete the image.
Hi Tim,
I tried it with the lightbox version you used and the imagefixthumb version (thanks for the help with finding the ID). Unfortunately it is only working for one single picture of three pictures in the post that I tested. Weird! Is it maybe that you have a different coppermine version (I mean the gallery)? Maybe the plugin is not working with the gallery vs.1.4.4…? *sad*
Strange. I’m not sure what’s going on then. I don’t think my changes are probably very robust, they just work for me and the imagefixthumb method. I’m moving away from Coppermine anyway so not really looking at it.
If it’s any help I’m using Coppermine 1.4.8 and Wordpress 2.0.4
Hello, have you considered using http://vikjavev.no/highslide/? If I knew php, I would do what you did with the coppermine script and lightbox and combined the two. I’m going to look at your code though to see what you did and see if maybe this problem of mine will be my intro to php.
I personally think the functionality of the highslide script is far superior to the lightbox script.
Lightbox and Coppermine plugins at sirjohn.co.uk