Index: colorbox.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/colorbox/colorbox.admin.inc,v
retrieving revision 1.16.2.1
diff -u -p -r1.16.2.1 colorbox.admin.inc
--- colorbox.admin.inc	7 Jul 2010 05:06:04 -0000	1.16.2.1
+++ colorbox.admin.inc	7 Sep 2010 05:52:21 -0000
@@ -67,6 +67,32 @@ function colorbox_admin_settings() {
     );
   }
 
+  if (module_exists('img_assist')) {
+    $form['colorbox_img_assist_module'] = array(
+      '#type' => 'fieldset',
+      '#title' => t('Image assist module settings'),
+    );
+    $form['colorbox_img_assist_module']['colorbox_auto_img_assist_custom'] = array(
+      '#type' => 'radios',
+      '#title' => t('Image Assist custom size image integration'),
+      '#options' => array(0 => t('Disabled'), 1 => t('Enabled')),
+      '#default_value' => variable_get('colorbox_auto_img_assist_custom', 0),
+      '#description' => t('Select if Colorbox should be activated for the Image Assist custom size image.'),
+    );
+    $derivative_options = array();
+    $sizes = image_get_sizes();
+    foreach ($sizes as $label => $size) {
+      $derivative_options[$label] = $size['label'];
+    }
+    $form['colorbox_img_assist_module']['colorbox_img_assist_derivative'] = array(
+      '#type' => 'select',
+      '#title' => t('Image derivative'),
+      '#options' => $derivative_options,
+      '#default_value' => variable_get('colorbox_img_assist_derivative', 'preview'),
+      '#description' => t('Select which image derivative to load in the Colorbox.'),
+    );
+  }
+
   if (module_exists('insert')) {
     $form['colorbox_insert_module'] = array(
       '#type' => 'fieldset',
Index: colorbox.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/colorbox/colorbox.module,v
retrieving revision 1.19.2.3
diff -u -p -r1.19.2.3 colorbox.module
--- colorbox.module	25 Jul 2010 17:35:28 -0000	1.19.2.3
+++ colorbox.module	7 Sep 2010 05:52:21 -0000
@@ -234,6 +234,16 @@ function _colorbox_doheader() {
     }
   }
 
+  if (module_exists('img_assist') && variable_get('colorbox_auto_img_assist_custom', 0)) {
+    $img_assist_derivative = variable_get('colorbox_img_assist_derivative', 'preview');
+    // If the image derivative is set to IMAGE_ORIGINAL check if the
+    // user has access before activating Colorbox.
+    if (!($img_assist_derivative == IMAGE_ORIGINAL && !user_access('view original images'))) {
+      drupal_add_js(array('colorbox' => array('img_assist_derivative' => $img_assist_derivative)), 'setting');
+      drupal_add_js($path .'/js/colorbox_img_assist_module.js');
+    }
+  }
+
   drupal_add_js(colorbox_get_path());
   drupal_add_js($path .'/js/colorbox.js');
 
Index: js/colorbox_img_assist_module.js
===================================================================
RCS file: js/colorbox_img_assist_module.js
diff -N js/colorbox_img_assist_module.js
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ js/colorbox_img_assist_module.js	7 Sep 2010 05:52:22 -0000
@@ -0,0 +1,36 @@
+// $Id$
+(function ($) {
+
+Drupal.behaviors.initColorboxImgAssistModule = function (context) {
+  var settings = Drupal.settings.colorbox;
+
+  // Handle "image-img_assist_custom" images.
+  $('span.inline > a', context).filter(':not(.initColorboxImgAssistModule-processed)').addClass('initColorboxImgAssistModule-processed').each(function (i) {
+    var $img = $('.image', this);
+    if ($img.length === 0) {
+      return true;
+    }
+
+    // Find derivative
+    var matches = $img.attr('class').match(/image\-(img_assist_custom\-\w+)/);
+    if (matches === null) {
+      return true;
+    }
+    var derivative = matches[1];
+
+    // Create link path
+    var path_replacement = settings.img_assist_derivative == '_original' ? '' : '.' + settings.img_assist_derivative;
+    var href = $img.attr('src').replace('.' + derivative, path_replacement);
+
+    // Modify link to image
+    this.href = href;
+    // Add rel tag to group
+    this.rel = 'img_assist-gallery';
+    // Add image link title
+    this.title = $img.attr('title');
+    // Colorbox it
+    $(this).addClass('colorbox');
+  });
+};
+
+})(jQuery);
