--- galleria.module.original	2010-12-17 16:33:29.000000000 -0500
+++ galleria.module	2011-01-18 03:21:07.000000000 -0500
@@ -90,7 +90,7 @@ function galleria_form_alter(&$form, $fo
       '#title' => t('Galleria from attachments'),
       '#default_value' => variable_get('galleria_'. $form['#node_type']->type, 0),
       '#options' => array(t('Disabled'), t('Enabled')),
-      '#description' => t('Convert attachments on this node type into Gallerias. You should not enable this if you are using a CCK ImageField for your Galleria.')
+      '#description' => t('Convert attachments on this node type into Gallerias. You should not enable this if you are using a CCK ImageField or Nodereference Image Helper for your Galleria.')
     );
   }
 }
@@ -110,6 +110,9 @@ function galleria_theme() {
     'galleria_formatter_imagefield_galleria' => array(
       'arguments' => array('element' => NULL),
     ),
+    'galleria_formatter_noderef_image_helper_galleria' => array(
+      'arguments' => array('element' => NULL),
+    ),
     'galleria_files' => array(
       'arguments' => array('node' => NULL),
     ),
@@ -366,13 +369,19 @@ function template_preprocess_galleria(&$
  * Implementation of hook_field_formatter_info().
  */
 function galleria_field_formatter_info() {
-  return array(
-    'imagefield_galleria' => array(
-      'label' => t('Galleria'),
+  $formatters['imagefield_galleria'] = array(
+      'label' => t('Galleria Imagefield'),
       'field types' => array('filefield'),
       'multiple values' => CONTENT_HANDLE_MODULE,
-    ),
   );
+  if (module_exists('noderef_image_helper')) {
+    $formatters['noderef_image_helper_galleria'] = array(
+        'label' => t('Galleria Node Ref'),
+        'field types' => array('nodereference'),
+        'multiple values' => CONTENT_HANDLE_MODULE,
+    );
+  }
+  return $formatters;
 }
 
 /**
@@ -397,3 +406,28 @@ function theme_galleria_formatter_imagef
 
   return theme('galleria', $images);
 }
+
+/**
+ * Theme Nodereference Image Helper referenced images in a Galleria.
+ *
+ */
+function theme_galleria_formatter_noderef_image_helper_galleria($element) {
+  galleria_includes();
+
+  $images = array();
+  foreach (element_children($element) as $key) {
+    if ($element[$key]['#item'] != NULL) {
+      $image = noderef_image_helper_image_from_nid($element[$key]['#item']['nid']);
+      $images[] = (object) array(
+        'filepath' => $image['filepath'],
+        'filename' => $image['filename'],
+        'description' => $image['data']['description'],
+        'alt' => $image['data']['alt'],
+      );
+
+    }
+  }
+
+  return theme('galleria', $images);
+}
+
