--- /Users/jjkiesch/Desktop/taxonomy_image_blocks/taxonomy_image_blocks.module	2008-08-02 11:05:25.000000000 -0500
+++ sites/dfwtzus.local/modules/taxonomy_image/contributed/taxonomy_image_blocks/taxonomy_image_blocks.module	2008-08-02 11:03:00.000000000 -0500
@@ -28,13 +28,19 @@ function taxonomy_image_block($op = 'lis
           $max = variable_get('taxonomy_image_block_max_images', 3);
           $suppress = variable_get('taxonomy_image_block_suppress', false);
           $size = variable_get('taxonomy_image_block_max_size', 32);
+          $imagecache_preset = variable_get('taxonomy_image_block_imagecache_preset', 'ORIGINAL');
           $name_link = l($term->name, $term_path);
           if (user_access('administer taxonomy')) {
             $name_link .= '<br/>'. l('edit term', 'admin/content/taxonomy/edit/term/'. $term->tid, array('class' => 'links inline'));
           }
           if ($node = node_load($nid)) {
             foreach ($node->taxonomy as $term) {
-              $img = taxonomy_image_display($term->tid, array(), 'ORIGINAL', array('resize' => 1, 'width' => $size, 'height' => $size));
+              if ($size == 'ORIGINAL') {
+                $img = taxonomy_image_display($term->tid, array(), null, array('imagecache_preset' => $imagecache_preset));
+              }
+              else {
+                $img = taxonomy_image_display($term->tid, array(), 'ORIGINAL', array('resize' => 1, 'width' => $size, 'height' => $size));
+              }
               if ($img || !$suppress) {
                 $term_path = drupal_get_path_alias(taxonomy_term_path($term));
                 $rows[] = array(
@@ -91,14 +97,44 @@ function taxonomy_image_block($op = 'lis
 
           $form['ti']['taxonomy_image_block_max_size'] = array(
             '#type' => 'radios',
-            '#options' => drupal_map_assoc(array(16, 24, 32, 48, 64, 80, 96)),
+            '#options' => drupal_map_assoc(array('ORIGINAL', 16, 24, 32, 48, 64, 80, 96)),
             '#title' => t('Maximum size'),
-            '#description' => t('This limits the size of images that appear in the "Node Images" block. This is the size, in pixels, of the longer side of the image.'),
+            '#description' => t('This limits the size of images that appear in the "Node Images" block. This is the size, in pixels, of the longer side of the image. Selecting "ORIGINAL" will keep the image at it\'s original size.'),
             '#default_value' => variable_get('taxonomy_image_block_max_size', 32),
             '#prefix' => '<div class="taxonomy_image_radios">',
             '#suffix' => '</div>',
             );
 
+            if (module_exists('imagecache')) {
+              if (function_exists('_imagecache_get_presets')) {
+                $presets = _imagecache_get_presets();
+              }
+              elseif (function_exists('imagecache_presets')) {
+                $ic_presets = imagecache_presets();
+                $presets = array();
+                foreach ($ic_presets as $preset_id => $preset_info) {
+                  $presets[$preset_info['presetid']] = $preset_info['presetname'];
+                }
+              }
+              else {
+                $msg = t('Unrecognized Imagecache API.');
+                drupal_set_message($msg, 'error');
+                return array('oops' => array('#value' => $msg));
+              }
+              $presets[0] = 'ORIGINAL';
+              sort($presets);
+
+              $form['ti']['taxonomy_image_block_imagecache_preset'] = array(
+                '#type' => 'radios',
+                '#title' => t('Imagecache Preset'),
+                '#description' => t('The Imagecache module is available. If you select one of these presets, or provide one in your call, then Taxonomy Image will use Imagecache to process the image and ignore the following settings. "ORIGINAL" effectively disables Imagecache and uses the following settings.'),
+                '#options' => drupal_map_assoc($presets),
+                '#default_value' => variable_get('taxonomy_image_block_imagecache_preset', null),
+                '#prefix' => '<div class="taxonomy_image_radios">',
+                '#suffix' => '</div>',
+                );
+            }
+
           break;
       } // end switch($delta)
 
@@ -111,6 +147,7 @@ function taxonomy_image_block($op = 'lis
           variable_set('taxonomy_image_block_max_images', $edit['taxonomy_image_block_max_images']);
           variable_set('taxonomy_image_block_suppress', $edit['taxonomy_image_block_suppress']);
           variable_set('taxonomy_image_block_max_size', $edit['taxonomy_image_block_max_size']);
+          variable_set('taxonomy_image_block_imagecache_preset', $edit['taxonomy_image_block_imagecache_preset']);
           variable_set('taxonomy_image_block_title', $edit['title']);
           // Don't let blocks.module have the real title.
           db_query("UPDATE {blocks} SET title='' WHERE module='taxonomy_image' AND delta=0");
