Index: taxonomy_image.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/taxonomy_image/taxonomy_image.module,v
retrieving revision 1.12.4.34
diff -u -p -r1.12.4.34 taxonomy_image.module
--- taxonomy_image.module	11 Nov 2008 19:25:42 -0000	1.12.4.34
+++ taxonomy_image.module	17 Nov 2008 17:01:16 -0000
@@ -582,39 +582,51 @@ function taxonomy_image_views_tables() {
         'name' => t('Taxonomy Image: Image'),
         'help' => t('The image associated with the node\'s taxonomy term.'),
         'handler' => array(
-          'views_handler_image_path' => t('Image'),
-        )
-      )
+          'taxonomy_image_views_handler' => t('Image'),
+          'taxonomy_image_views_handler_link' => t('Image as Link'),
+        ),
+      ),
     ),
   );
 
   if (module_exists('imagecache')) {
-    $presets[''] = 'Default';
-    $tables['term_image']['fields']['tid']['option'] = array(
-      '#type' => 'select',
-      '#options' => _taxonomy_image_presets(),
-      );
+    $tables['term_image']['fields']['tid']['option']['#options'] = _taxonomy_image_presets();  
+    $tables['term_image']['fields']['tid']['option']['#type'] = 'select';
   }
 
   return $tables;
 }
 
-function views_handler_image_path($fieldinfo, $fielddata, $value, $data) {
+/**
+ * Handler for Taxonomy Image views field.
+ */
+function taxonomy_image_views_handler($fieldinfo, $fielddata, $value, $data) {
   if (empty($fielddata['options'])) {
     return taxonomy_image_display($value);
   }
-  else{
-    if (drupal_substr($fielddata['options'], -5, 5) == '_link') {
-      $profile=drupal_substr($fielddata['options'], 0, -5);
-      $img = taxonomy_image_display($value, $data->name, $profile);
-      $img = l($img, taxonomy_term_path(taxonomy_get_term($value)), array(), NULL, NULL, FALSE, TRUE);
-      return $img;
-    }
-    else{
-      $profile = $fielddata['options'];
-      $img = taxonomy_image_display($value, $data->name, $profile);
-      return $img;
-    }
+  else {
+    $profile = imagecache_preset($fielddata['options']);
+    $profile_name = $profile['presetname'];
+    $img = taxonomy_image_display($value, $data->name, $profile_name);
+    return $img;
+  }
+}
+
+/**
+ * Handler for Taxonomy Image views field as link.
+ */
+function taxonomy_image_views_handler_link($fieldinfo, $fielddata, $value, $data) {
+  if (empty($fielddata['options'])) {
+    $img = taxonomy_image_display($value, $data->name);
+    $img = l($img, taxonomy_term_path(taxonomy_get_term($value)), array(), NULL, NULL, FALSE, TRUE);
+    return $img;
+  }
+  else {
+    $profile = imagecache_preset($fielddata['options']);
+    $profile_name = $profile['presetname'];
+    $img = taxonomy_image_display($value, $data->name, $profile_name);
+    $img = l($img, taxonomy_term_path(taxonomy_get_term($value)), array(), NULL, NULL, FALSE, TRUE);
+    return $img;
   }
 }
 
