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.

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

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

  • Anja

    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

  • Anja

    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.

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

  • Anja

    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?

  • Anja

    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?

  • Anja

    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…

  • Anja

    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.

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

  • Anja

    Hi Tim,
    thanks for your tips, I’ll give it a new try 🙂 Will let you know if it works or not.
    How and where to find the permanent image ID in coppermine though?

  • Anja

    Hi Tim,
    thanks for your tips, I’ll give it a new try 🙂 Will let you know if it works or not.
    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.

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

  • Anja

    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*

  • Anja

    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

  • 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

  • kristin

    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.

  • kristin

    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

  • Lightbox and Coppermine plugins at sirjohn.co.uk

  • Corne

    Do you still give support for this?

    I was wondering if you ever got it to work with whole albums and Lightbox?

    One picture opens in lightbox, so you got that correct..

    But as you said here above, it doesn’t work when you link a whole album..

  • Corne

    Do you still give support for this?

    I was wondering if you ever got it to work with whole albums and Lightbox?

    One picture opens in lightbox, so you got that correct..

    But as you said here above, it doesn’t work when you link a whole album..

  • I thought I replied already but can’t see my reply, so I’ll try again…

    Unfortunately I’m not really supporting this any more as I no longer use Coppermine and WordPress has also moved on a bit since then so I don’t know if it works with latest versions. I never did get it to work with albums, but have to admit I didn’t try that much. Anyway the source is here for anyone to modify. After all I just modified the existing Coppermine Plugin.

    I haven’t checked to see if that plugin has been updated and if maybe lightbox has been integrated into the original. Maybe it has, or maybe there’s another plugin that does similar.

  • I thought I replied already but can’t see my reply, so I’ll try again…

    Unfortunately I’m not really supporting this any more as I no longer use Coppermine and WordPress has also moved on a bit since then so I don’t know if it works with latest versions. I never did get it to work with albums, but have to admit I didn’t try that much. Anyway the source is here for anyone to modify. After all I just modified the existing Coppermine Plugin.

    I haven’t checked to see if that plugin has been updated and if maybe lightbox has been integrated into the original. Maybe it has, or maybe there’s another plugin that does similar.