Drupal7 MediaGallery Colorbox Integration

spying spaniel

I recently installed the DRUPAL MEDIA GALLERY module and really like it. Finding a simple to conifgure Drupal Image Gallery has been a thorn in my side for an age. This one works nearly perfectly - except it just will not handle COLOROBOX as its image handler because of its inbuilt integration with LIGHTBOX  - a similar function but I prefer the way colorbox looks looks. So before I was forced to unisntall colorbox and integrate lightbox instead, a quick Google search showed me this simply excellent blog post by Paul Junior.

It's not often I repost someone elses blog but this one is just spot on:

Anyone who has tried to user the Media Gallery module on a site that already has the Colorbox module installed will know that they do not play well together.  If you have both modules enabled, create a gallery (with lightbox capabilities) and try to click a thumbnail, the lightbox will not show.

This is because, essentially, Colorbox is being called twice, once by the Colorbox module and second by the Media Gallery module.  To fix this without applying any patches or editing any code, follow these steps:

Pathauto

  1. If you do not have the Pathauto module installed and enabled (most likely you already do), do so now

  2. Go to Configuration > URL aliases > Patterns

  3. In the Pattern for all Gallery paths textfield, type galleries/[node:title]

  4. Click the Save configuration button at the bottom of the page.

Colorbox

  1. Go to Configuration > Colorbox

  2. Click Advanced settings at the bottom of the page

  3. In the Deactivate Colorbox on specific pages textarea, add galleries/* to the bottom of the textarea so it looks like this:

    admin*
    img_assist*
    imce*
    node/add/*
    node/*/edit
    galleries/*
  4. Click the Save configuration button at the bottom of the page.
You will need to edit any existing galleries you have created, ticking the Automatic alias checkbox under the Url path settings tab and clicking the Save button.
 
This will essentially disable the Colorbox module for all galleries so that the Media Gallery module can use it's own implementation of Colorbox.  Let's keep our fingers crossed that the Media Gallery development team decides to rely on the Colorbox module in the future for lightbox functionality.


One other little thing I discovered is the Colorbox still doesnt display prooperly if you use a display block (just like I am) on the front page. So, if you want to also display colorbox'ed images from the Gallery module on the fonr tpage then you also need to do this:

 

In the Deactivate Colorbox on specific pages textarea, add <front> to the bottom of the textarea so it looks like this:

admin*
img_assist*
imce*
node/add/*
node/*/edit
galleries/*
<front>
Tag Cloud: