Index: taxonomy_image.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/taxonomy_image/taxonomy_image.install,v
retrieving revision 1.1.4.5.2.4
diff -u -r1.1.4.5.2.4 taxonomy_image.install
--- taxonomy_image.install	8 Apr 2008 15:15:06 -0000	1.1.4.5.2.4
+++ taxonomy_image.install	8 Apr 2008 16:05:28 -0000
@@ -63,10 +63,46 @@
     'primary key' => array('tid'),
     );
 
+  $schema['cache_tax_image'] = array(
+    'module' => 'Taxonomy Image',
+    'fields' => array(
+      'cid' => array('type' => 'varchar', 'length' => '255', 'not null' => TRUE, 'default' => ''),
+      'data' => array('type' => 'blob', 'size' => 'big', 'not null' => FALSE),
+      'expire' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'disp-width' => '11'),
+      'created' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'disp-width' => '11'),
+      'headers' => array('type' => 'text', 'not null' => FALSE)),
+    'primary key' => array('cid'),
+    'indexes' => array(
+      'expire' => array('expire')),
+    );
+
   return $schema;
 }
 
 /**
+ * Implementation of hook_update_N().
+ */
+function taxonomy_image_update_6100() {
+  $schema['cache_tax_image'] = array(
+    'module' => 'Taxonomy Image',
+    'fields' => array(
+      'cid' => array('type' => 'varchar', 'length' => '255', 'not null' => TRUE, 'default' => ''),
+      'data' => array('type' => 'blob', 'size' => 'big', 'not null' => FALSE),
+      'expire' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'disp-width' => '11'),
+      'created' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'disp-width' => '11'),
+      'headers' => array('type' => 'text', 'not null' => FALSE)),
+    'primary key' => array('cid'),
+    'indexes' => array(
+      'expire' => array('expire')),
+    );
+
+  $ret = array();
+  db_create_table($ret, 'cache_tax_image', $schema['cache_tax_image']);
+
+  return $ret;
+}
+
+/**
  * Implementation of hook_install().
  */
 function taxonomy_image_install() {
Index: taxonomy_image.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/taxonomy_image/taxonomy_image.module,v
retrieving revision 1.12.4.13.2.10
diff -u -r1.12.4.13.2.10 taxonomy_image.module
--- taxonomy_image.module	8 Apr 2008 15:15:06 -0000	1.12.4.13.2.10
+++ taxonomy_image.module	8 Apr 2008 16:11:56 -0000
@@ -202,6 +202,11 @@
       return $image[$tid];
     }
     else {
+      $cache_obj = cache_get("taxonomy_image:$tid", 'cache_tax_image');
+      if ($cache_obj) {
+        $image[$tid] = unserialize($cache_obj->data);
+        return $image[$tid];
+      }
       if ($image[$tid] = db_fetch_object(db_query('SELECT i.path, d.name, d.description FROM {term_image} i INNER JOIN {term_data} d USING(tid) WHERE i.tid=%d', $tid))) {
         $image[$tid]->url = file_create_url($image[$tid]->path);
       }
@@ -226,6 +231,7 @@
     }
 		// Get more properties if we had an image.
     if ($image[$tid]->path) {
+      $image[$tid]->tid = $tid;
       $img = getimagesize($image[$tid]->path);
       $exts = array(1 => 'gif', 'jpeg', 'png', 'swf', 'psd', 'bmp',
         'tiff', 'tiff', 'jpc', 'jp2', 'jpf', 'jb2', 'swc',
@@ -245,6 +251,8 @@
         .'title="'. check_plain(($image[$tid]->description ? $image[$tid]->description : $image[$tid]->name))  .'" '
         .'>';
     }
+
+    cache_set("taxonomy_image:$tid", 'cache_tax_image', serialize($image[$tid]));
     return $image[$tid];
   }
   return null;
@@ -619,6 +627,9 @@
 }
 
 function taxonomy_image_delete($tid) {
+  // Delete the cached version.
+  cache_clear_all("taxonomy_image:$tid", 'cache_tax_image');
+
   $old_path = db_result(db_query('SELECT path FROM {term_image} WHERE tid=%d', $tid));
   $how_many = db_result(db_query("SELECT COUNT(path) FROM {term_image} WHERE path='%s'", $old_path));
   if ($how_many == 1) {
