Index: taxonomy_image/taxonomy_image.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/taxonomy_image/taxonomy_image.module,v
retrieving revision 1.12.4.1
diff -u -p -r1.12.4.1 taxonomy_image.module
--- taxonomy_image/taxonomy_image.module	18 Jan 2007 05:00:24 -0000	1.12.4.1
+++ taxonomy_image/taxonomy_image.module	3 Dec 2007 12:27:58 -0000
@@ -240,6 +240,34 @@ function taxonomy_image_admin_settings()
     '#options' => array(1 => 'Enabled', 0 => 'Disabled'),
     '#description' => t('When enabled, taxonomy_image_display() will recursively search for an image to display, starting with the passed in term, then trying the term\'s parents.  This functionality is only useful if you have defined hierarchical taxonomies, and multiple terms within a tree will share the same image.  If this doesn\'t mean anything to you, leave this option disabled.'),
   );
+  
+  $form['node_view'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Node Display'),
+  );
+  $form['node_view']['taxonomy_image_node_view'] = array(
+    '#type' => 'checkboxes',
+    '#title' => t('Display taxonomy images on tagged nodes'),
+    '#options' => array_map('check_plain', node_get_types('names')),
+    '#default_value' => variable_get('taxonomy_image_node_view', array()),
+  );
+  $form['node_view']['taxonomy_image_node_view_teaser'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Show Taxonomy Image in node teaser view'),
+    '#default_value' => variable_get('taxonomy_image_node_view_teaser', TRUE),
+  );
+  $form['node_view']['taxonomy_image_node_view_link'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Link displayed Taxonomy Image to taxonomy/term/n page'),
+    '#default_value' => variable_get('taxonomy_image_node_view_link', TRUE),
+  );
+  $form['node_view']['taxonomy_image_node_view_weight'] = array(
+    '#type' => 'weight',
+    '#title' => t('Display weight of taxonomy images'),
+    '#options' => array_map('check_plain', node_get_types('names')),
+    '#default_value' => variable_get('taxonomy_image_node_view_weight', -5),
+  );
+
 
   return system_settings_form($form);
 }
@@ -400,7 +428,9 @@ function taxonomy_image_form($edit = arr
 function taxonomy_image_save($tid) {
   $edit['tid'] = $tid;
   $fields = array('tid', 'path');
-  if ($file = file_save_upload('path', file_create_path(variable_get('taxonomy_image_path', 'category_pictures')))) {
+  $directory = file_create_path(variable_get('taxonomy_image_path', 'category_pictures'));
+  file_check_directory(&$directory, FILE_CREATE_DIRECTORY);
+  if ($file = file_save_upload('path', $directory)) {
     $edit['path'] = $file->filepath;
 
     if ($old_image = db_fetch_object(db_query('SELECT tid FROM {term_image} WHERE tid = %d', $edit['tid']))) {
@@ -441,4 +471,25 @@ function _taxonomy_image_exists($tid) {
   return 0;
 }
 
-?>
+function taxonomy_image_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
+  switch ($op) {
+    case 'view' :
+      if ($teaser && ! variable_get('taxonomy_image_node_view_teaser', TRUE)) {
+        return;
+      }
+      $valid_nodes = variable_get('taxonomy_image_node_view', array()); 
+      if ($valid_nodes[$node->type]) {
+        foreach ($node->taxonomy as $term) {
+          $image = taxonomy_image_display($term->tid);
+          if (variable_get('taxonomy_image_node_view_link', TRUE)) {
+            $image = l($image, url('taxonomy/term/'. $term->tid), array(), NULL, NULL, NULL, TRUE);
+          }
+          $images[] = $image; 
+        }
+        $node->content['taxonomy_image'] = array(
+          '#value' => join($images, "\n"),
+          '#weight' => variable_get('taxonomy_image_node_view_weight', -5),
+        );
+      }
+  }  
+}
