Index: imceimage.module
===================================================================
RCS file: /cvsrep/Sites/ctc/mediacentre/sites/all/modules/imceimage/imceimage.module,v
retrieving revision 1.1
diff -w -b -a -u -r1.1 imceimage.module
--- imceimage.module	6 Jun 2008 23:25:42 -0000	1.1
+++ imceimage.module	28 Oct 2008 00:06:15 -0000
@@ -96,6 +96,11 @@
       'field types' => array('imceimage'),
       'multiple values' => CONTENT_HANDLE_CORE,
     ),
+    'thumb' => array(
+      'label' => 'Thumbnail',
+      'field types' => array('imceimage'),
+      'multiple values' => CONTENT_HANDLE_CORE,
+    ),
   );
 }
 
@@ -194,6 +199,12 @@
       return $element;
 }
 
+
+// hook_views_api
+function imceimage_views_api() {
+  return array('api' => 2.0);
+}
+
 /**
  * theme an image
  */
@@ -207,6 +218,35 @@
   return '<img '. $s . $a . $w . $h . $id .'/>';
 }
 
+
+function _imceimage_get_thumb($image) {
+  $thumb_prefix = 'thumb_';
+  $path = $image['imceimage_path'];
+  $thumb_name = $thumb_prefix . basename($path);
+  $thumb_path = dirname($path) . "/" . $thumb_name;
+
+  list($width, $height, $type, $image_attributes) = @getimagesize($thumb_path);
+  $thumb = array();
+  $thumb['imceimage_path'] = $thumb_path;
+  $thumb['imceimage_width'] = $width; 
+  $thumb['imceimage_height'] = $height; 
+  $thumb['imceimage_alt'] = $image['imceimage_alt']; 
+  return $thumb;   
+}
+
+/**
+ * displays the image as a link. given the class imceimage-link
+ **/
+function theme_imceimage_formatter_thumb($element) {
+  $item = $element['#item'];
+  $field = $element['#field_name'];
+  $delta = $element['#delta'];
+  $id = "imceimage-". $field ."-". $delta . '-thumb';
+  $thumb = _imceimage_get_thumb($item);
+  return theme_imceimage_image($thumb['imceimage_path'], $thumb['imceimage_width'],$thumb['imceimage_height'],$thumb['imceimage_alt'],$id);
+
+}
+
 /**
  * displays the image as a link. given the class imceimage-link
  **/
@@ -247,6 +287,9 @@
     'imceimage_formatter_link' => array(
        'arguments' => array('element' => NULL),
     ),
+    'imceimage_formatter_thumb' => array(
+       'arguments' => array('element' => NULL),
+    ),
   );
 }

