Index: image_gallery.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/image/contrib/image_gallery/image_gallery.module,v
retrieving revision 1.5.2.12
diff -u -r1.5.2.12 image_gallery.module
--- image_gallery.module	22 Aug 2007 17:39:45 -0000	1.5.2.12
+++ image_gallery.module	4 Sep 2007 16:17:26 -0000
@@ -88,7 +88,12 @@
     '#default_value' => variable_get('image_gallery_node_info', 0),
     '#description' => t("Checking this will display the \"Posted by\" node information on the gallery pages."),
   );
-
+  $form['gallery']['image_gallery_display_description'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Display gallery description'),
+    '#default_value' => variable_get('image_gallery_display_description', 0),
+    '#description' => t("Checking this will display the gallery description on the gallery pages."),
+  );
   return system_settings_form($form);
 }
 
@@ -147,7 +152,11 @@
     $last = db_fetch_object(db_query_range(db_rewrite_sql('SELECT n.nid FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE tn.tid IN (%s) AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC'), implode(',', $descendant_tids), 0, 1));
     $galleries[$i]->latest = node_load(array('nid' => $last->nid));
   }
-
+  // If there isn't a gallery tree, we may still want a gallery object from which to extract a gallery description.
+  // Do so if the admin has chosen to display gallery descriptions.
+  if (count($galleries) == 0 && variable_get('image_gallery_display_description',0) == 1) {
+    $galleries = taxonomy_get_term($tid);
+  }
   $images = array();
   if ($tid) {
     $result = pager_query(db_rewrite_sql("SELECT n.nid 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 ORDER BY n.sticky DESC, n.created DESC"), variable_get('image_images_per_page', 6), 0, NULL, $tid);
@@ -330,7 +339,7 @@
   $size = image_get_sizes(IMAGE_THUMBNAIL);
 
   $content = '';
-  if (count($galleries)) {
+  if (count($galleries) > 1) {
     $content .= '<ul class="galleries">';
     foreach ($galleries as $gallery) {
       $content .= '<li class="clear-block">';
@@ -347,6 +356,11 @@
     }
     $content .= "</ul>\n";
   }
+  // Else there is only one item in the galleries array (the gallery is by itself).
+  // Check admin setting to decide whether to display the description.
+  else if (count($galleries) && variable_get('image_gallery_display_description',0) == 1) {
+    $content .= '<div class="description">'. check_markup($galleries->description) ."</div>\n";
+  }
 
   if (!empty($images)) {
     $content .= '<ul class="images">';
