Index: modules/image/image.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/image/image.module,v
retrieving revision 1.140
diff -u -r1.140 image.module
--- modules/image/image.module	24 Mar 2005 05:05:24 -0000	1.140
+++ modules/image/image.module	24 Mar 2005 11:04:12 -0000
@@ -373,8 +373,8 @@
   drupal_set_html_head('<style type="text/css">@import url('.drupal_get_path('module','image').'/image.css);</style>');
   $albums = taxonomy_get_tree(_image_get_vid(), $tid, -1, 1);
   for ($i=0; $i < count($albums); $i++) {
-    $albums[$i]->count = db_result(db_query("SELECT COUNT(*) FROM {term_node} t INNER JOIN {node} n ON t.nid=n.nid WHERE n.status=1 AND n.type='image' AND t.tid=%d", $albums[$i]->tid));
-    $last = db_fetch_object(db_query_range("SELECT n.nid FROM {node} n INNER JOIN {term_node} t ON n.nid = t.nid WHERE t.tid=%d AND n.type = 'image' AND n.status = 1 ORDER BY n.sticky DESC, n.changed DESC", $albums[$i]->tid, 0, 1));
+    $albums[$i]->count = db_result(db_query(db_rewrite_sql("SELECT COUNT(*) FROM {term_node} t INNER JOIN {node} n ON t.nid=n.nid WHERE n.status=1 AND n.type='image' AND t.tid=%d"), $albums[$i]->tid));
+    $last = db_fetch_object(db_query_range(db_rewrite_sql("SELECT n.nid FROM {node} n INNER JOIN {term_node} t ON n.nid = t.nid WHERE t.tid=%d AND n.type = 'image' AND n.status = 1 ORDER BY n.sticky DESC, n.changed DESC"), $albums[$i]->tid, 0, 1));
     $albums[$i]->latest = node_load(array('nid' => $last->nid));
   }
   
