Index: galleria.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/galleria/Attic/galleria.admin.inc,v
retrieving revision 1.1.2.5
diff -u -r1.1.2.5 galleria.admin.inc
--- galleria.admin.inc	23 Mar 2009 14:40:16 -0000	1.1.2.5
+++ galleria.admin.inc	13 Apr 2009 19:25:59 -0000
@@ -50,6 +50,39 @@
     drupal_set_message(t('If you install the imagecache module, you will get extra options here for integration.'), 'status');
   }
 
+  if (module_exists('lightbox2') || module_exists('jlightbox')) {
+    $form['galleria_lightbox'] = array('#type' => 'fieldset', '#title' => t('Lightbox Integration'));
+    $form['galleria_lightbox']['galleria_lightbox'] = array(
+      '#type' => 'select',
+      '#title' => t('Lightbox integration'),
+      '#options' => array(
+        'none' => 'None',
+      ),
+      '#default_value' => variable_get('galleria_lightbox', 'none'),
+      '#description' => t('Lightbox integration lets you open Galleria images in a Lightbox.'),
+    );
+    if (module_exists('lightbox2')) {
+      $form['galleria_lightbox']['galleria_lightbox']['#options']['lightbox2'] = 'Lightbox2';
+    }
+    if (module_exists('jlightbox')) {
+      $form['galleria_lightbox']['galleria_lightbox']['#options']['jlightbox'] = 'jQuery Lightbox';
+    }
+    if (module_exists('imagecache')) {
+      $raw_presets = imagecache_presets();
+      $presets[''] = t('None');
+      foreach ($raw_presets as $preset_id => $preset_info) {
+        $preset = $preset_info['presetname'];
+        $presets[$preset] = $preset;
+      }
+      $form['galleria_lightbox']['galleria_lightbox_preset'] = array(
+        '#type' => 'select',
+        '#title' => t('ImageCache Lightbox preset'),
+        '#options' => $presets,
+        '#default_value' => variable_get('galleria_lightbox_preset', ''),
+      );
+    }
+  }
+
   $form['galleria_show_page_warning'] = array(
     '#type' => 'checkbox',
     '#title' => t('Galleria warnings'),
Index: galleria.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/galleria/galleria.module,v
retrieving revision 1.1.2.13
diff -u -r1.1.2.13 galleria.module
--- galleria.module	23 Mar 2009 14:40:16 -0000	1.1.2.13
+++ galleria.module	13 Apr 2009 19:12:36 -0000
@@ -19,6 +19,7 @@
 
     $settings = array(
       'thumb_opacity' => variable_get('galleria_thumb_opacity', 0.3),
+      'galleria_lightbox' => variable_get('galleria_lightbox', 'none'),
     );
     drupal_add_js($settings, 'setting');
     $included = TRUE;
@@ -243,13 +244,15 @@
   $imagecache_exists = module_exists('imagecache');
   $img_preset = variable_get('galleria_imagecache_preset', '');
   $thumb_preset = variable_get('galleria_thumb_imagecache_preset', '');
+  $lightbox_preset = variable_get('galleria_lightbox_preset', '');
 
   foreach ($files as $file) {
     $caption = $file->description != $file->filename ? $file->description : '';
     $url = $file->filepath;
+    $lightbox_url = ($imagecache_exists && $lightbox_preset) ? imagecache_create_url($lightbox_preset, $file->filepath) : url($url, array('absolute' => TRUE));
 
     if ($imagecache_exists && $thumb_preset) {
-      $thumb = theme('imagecache', $thumb_preset, $file->filepath, $caption, $caption);
+      $thumb = theme('imagecache', $thumb_preset, $file->filepath, $lightbox_url, $caption);
     }
 
     if ($imagecache_exists && $img_preset) {
@@ -259,7 +262,7 @@
       }
       else {
         // Preset for only the gallery image
-        $image = theme('imagecache', $img_preset, $file->filepath, $caption, $caption);
+        $image = theme('imagecache', $img_preset, $file->filepath, $lightbox_url, $caption);
       }
     }
     else {
@@ -269,7 +272,7 @@
       }
       else {
         // No presets selected
-        $image = theme('image', $file->filepath, $caption, $caption);
+        $image = theme('image', $file->filepath, $lightbox_url, $caption);
       }
     }
 
Index: inc/galleria.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/galleria/inc/galleria.js,v
retrieving revision 1.1.2.3
diff -u -r1.1.2.3 galleria.js
--- inc/galleria.js	16 Jan 2009 17:02:58 -0000	1.1.2.3
+++ inc/galleria.js	13 Apr 2009 19:22:19 -0000
@@ -2,6 +2,18 @@
 
 var options = {
   onImage : function(image, caption, thumb) {
+    // Lightbox support
+    if (Drupal.settings.galleria_lightbox != 'none') {
+      // surround the displayed image with a Lightbox link
+      image.wrap('<a href="' + thumb.siblings('a').attr('href') + '" rel="lightbox[galleria]" title="' + caption.text() + '"></a>');
+      // keep Galleria from adding a click event to the image
+      $.galleria.clickNext = false; 
+      image.attr('title','View full-size');
+    }
+    else {
+      image.attr('title','Next image >>');
+    }
+
     // let's add some image effects for demonstration purposes
     // fade in the image & caption
     if(!($.browser.mozilla && navigator.appVersion.indexOf("Win")!=-1) ) { // FF/Win fades large images terribly slow
@@ -18,10 +30,17 @@
     // fade in active thumbnail
     thumb.fadeTo('fast',1).addClass('selected');
 
-    // add a title for the clickable image
-    image.attr('title','Next image >>');
-
     $('.galleria-nav').show();
+
+    // scan the page for new Lightbox links
+    switch (Drupal.settings.galleria_lightbox) {
+      case 'lightbox2':
+        Lightbox.initList();
+        break;
+      case 'jlightbox':
+        Lightbox.updateImageList();
+        break;
+    }
   },
 
   onThumb : function(thumb) {
@@ -40,6 +59,23 @@
       function() { thumb.fadeTo('fast', 1); },
       function() { _li.not('.active').children('img').fadeTo('fast', Drupal.settings.thumb_opacity); } // don't fade out if the parent is active
     )
+
+    // Lightbox support
+    if (Drupal.settings.galleria_lightbox != 'none') {
+      // add a Lightbox link after each thumbnail
+      thumb.after('<a href="' + thumb.attr('alt') + '" rel="lightbox[galleria]" title="' + thumb.attr('title') + '"></a>');
+      if (_li.hasClass('last')) {
+        // scan the page for new Lightbox links once the last thumnail is loaded
+        switch (Drupal.settings.galleria_lightbox) {
+          case 'lightbox2':
+            Lightbox.initList();
+            break;
+          case 'jlightbox':
+            Lightbox.updateImageList();
+            break;
+        }
+      }
+    }
   },
 
   history : false

