--- imceimageorig.module	2008-12-29 16:57:46.000000000 -0600
+++ imceimage.module	2009-01-14 23:16:34.000000000 -0600
@@ -85,7 +85,7 @@ function imceimage_content_is_empty($ite
 *     this formatter.
 */
 function imceimage_field_formatter_info() {
-  return array(
+  $formatter_options = array(
     'default' => array(
       'label' => 'Default',
       'field types' => array('imceimage'),
@@ -100,13 +100,21 @@ function imceimage_field_formatter_info(
       'label' => 'Link',
       'field types' => array('imceimage'),
       'multiple values' => CONTENT_HANDLE_CORE,
-    ),
-    'thumb' => array(
-      'label' => 'Thumbnail',
-      'field types' => array('imceimage'),
-      'multiple values' => CONTENT_HANDLE_CORE,
-    ),
+    ),  
   );
+      
+    
+	  // ADD ImageCache Options 
+	  foreach (imagecache_presets() as $preset) {
+		  $formatter_options[$preset['presetname']] =  array(
+		      'label' => 'ImageCache: ' . $preset['presetname'],
+		      'field types' => array('imceimage'),
+		      'multiple values' => CONTENT_HANDLE_CORE,
+		    );																     
+	  }
+	  
+
+  return $formatter_options;
 }
 
 
@@ -223,6 +231,22 @@ function theme_imceimage_image($s, $w=''
 }
 
 
+
+// Imagecache Addition
+function theme_imceimage_formatter_imagecache($element) {
+  $item = $element['#item'];
+  $preset = $element["#formatter"];
+	$plain_url = str_replace(base_path() . file_directory_path() . '/', '', $item['imceimage_path']);
+	$imagecache_url = imagecache_create_url($preset, $plain_url);
+	
+  return '<img src="' . $imagecache_url . '" alt="' . $item['imceimage_alt'] . '" />';
+  
+  return $tmp;
+}
+// end Imagecache addition
+
+
+
 function _imceimage_get_thumb($image) {
   $thumb_prefix = 'thumb_';
   $path = $image['imceimage_path'];
@@ -303,8 +327,10 @@ function theme_imceimage($element) {
  * to provide the default theme and also a theme to display the
  * image as a link.
  **/
+ 
+ //  MODIFICATION TO GRAB IMAGECACHE PRESETS
 function imceimage_theme() {
-  return array(
+  $theme = array(
     'imceimage' => array(
        'arguments' => array('element' => NULL),
     ),
@@ -321,7 +347,18 @@ function imceimage_theme() {
        'arguments' => array('element' => NULL),
     ),
   );
+  
+  foreach (imagecache_presets() as $preset) {
+	  $theme['imceimage_formatter_'. $preset['presetname']] = array(
+	    'arguments' => array('element' => NULL),
+			'function' => 'theme_imceimage_formatter_imagecache',	    
+  	);
+  }
+  
+  return $theme;
+  
 }
+// BIS MODIFICATION
 
 /**
  * hook_elements - implementation defines name of the field type and
