--- galleria/galleria.module 
+++ galleriaMy/galleria.module 
@@ -105,6 +105,9 @@
     ),
     'galleria_lightbox_link' => array(
       'arguments' => array('nid' => NULL),
+    ),
+    'galleria_formatter_imagefield_galleria' => array(
+      'arguments' => array('element' => NULL),
     ),
   );
 }
@@ -235,8 +238,29 @@
  * Preprocess the galleria variables.
  */
 function template_preprocess_galleria(&$vars) {
+  $images = array();
+  $i = 0;
   $node = $vars['node'];
   $files = $node->files;
+
+  $filearray = array();
+  foreach ($files as $file) {
+     $filearray[] = array(
+        'filepath' => $file->filepath,
+        'filename' => $file->filename,
+        'description' => $file->description,
+        );
+  }
+  $temp = _galleria_buildup($filearray);
+
+  $vars['next_prev_links'] = $temp['next_prev_links'];
+  $vars['gallery'] = $temp['gallery'];
+}
+
+/**
+ * an array with filepath, filename, description
+ */
+function _galleria_buildup($files){
   $images = array();
   $i = 0;
 
@@ -245,31 +269,35 @@
   $thumb_preset = variable_get('galleria_thumb_imagecache_preset', '');
 
   foreach ($files as $file) {
-    $caption = $file->description != $file->filename ? $file->description : '';
-    $url = $file->filepath;
+    $filepath  = $file['filepath'];
+    $filename =  $file['filename'];
+    $filedescription =  $file['description'];
+
+    $caption = $filedescription != $filename ? $filedescription : '';
+    $url = $filepath;
 
     if ($imagecache_exists && $thumb_preset) {
-      $thumb = theme('imagecache', $thumb_preset, $file->filepath, $caption, $caption);
+      $thumb = theme('imagecache', $thumb_preset, $filepath, $caption, $caption);
     }
 
     if ($imagecache_exists && $img_preset) {
       if ($thumb) {
         // Preset for both thumbnail and gallery image
-        $image = l($thumb, imagecache_create_url($img_preset, $file->filepath), array('html' => TRUE, 'attributes' => array('title' => $caption)));
+        $image = l($thumb, imagecache_create_url($img_preset, $filepath), array('html' => TRUE, 'attributes' => array('title' => $caption)));
       }
       else {
         // Preset for only the gallery image
-        $image = theme('imagecache', $img_preset, $file->filepath, $caption, $caption);
+        $image = theme('imagecache', $img_preset, $filepath, $caption, $caption);
       }
     }
     else {
       if ($thumb) {
         // Preset for only the thumbnail image
-        $image = l($thumb, $file->filepath, array('html' => TRUE, 'attributes' => array('title' => $caption)));
+        $image = l($thumb, $filepath, array('html' => TRUE, 'attributes' => array('title' => $caption)));
       }
       else {
         // No presets selected
-        $image = theme('image', $file->filepath, $caption, $caption);
+        $image = theme('image', $filepath, $caption, $caption);
       }
     }
 
@@ -287,5 +315,55 @@
 
   $vars['next_prev_links'] = '<a onclick="$.galleria.prev(); return false;" href="#"><< ' . t('previous') . '</a> | <a onclick="$.galleria.next(); return false;" href="#">' . t('next') . '>></a>';
   $vars['gallery'] = theme('item_list', $images, NULL, 'ul', $attribs);
-}
-
+
+  return $vars;
+}
+
+
+
+/**
+ * Implementation of hook_field_formatter_info(),.
+ */
+function galleria_field_formatter_info() {
+  return array(
+    'imagefield_galleria' => array(
+      'label' => t('Styled by Galleria'),
+      'field types' => array('filefield'),
+      'multiple values' => CONTENT_HANDLE_MODULE,
+    ),
+  );
+}
+
+
+
+/**
+ * Theme a textfield as a comma-separated list.
+ *
+ * @ingroup themeable
+ */
+function theme_galleria_formatter_imagefield_galleria($element) {
+
+    galleria_includes();
+
+    $item = $element;
+    
+    foreach (element_properties($element) as $key) {
+        //kill properties
+        unset($item[$key]);
+    }
+
+    $files = array();
+    foreach($item as $image){
+      //build files array
+      $files[] = array(
+        'filepath' => $image['#item']['filepath'],
+        'filename' => $image['#item']['filename'],
+        'description' => $image['#description'],
+        );
+
+    }
+
+    $temp = _galleria_buildup($files);
+    return $temp['gallery'] .$temp['next_prev_links'];
+}
+
