Index: image.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/image/image.module,v
retrieving revision 1.278
diff -u -r1.278 image.module
--- image.module   2 Dec 2008 00:31:38 -0000   1.278
+++ image.module   19 Dec 2008 19:40:54 -0000
@@ -662,7 +662,7 @@
  * Theme a body
  */
 function theme_image_body($node, $size) {
-  return image_display($node, $size);
+return ph_image_navigation($node) . image_display($node, $size) . $node->body;
 }
 
 /**
@@ -1043,3 +1043,32 @@
   );
 }
 
+function ph_image_navigation(&$node) {
+global $base_url;
+$previous=0;
+$next=0;
+$tmp_prev=-1;
+$output="<br>";
+$terms = taxonomy_node_get_terms_by_vocabulary($node, _image_gallery_get_vid());
+if ($terms) {
+$term = array_pop($terms);
+$res = db_query("SELECT n.nid FROM {term_node} t, {node} n WHERE t.tid=$term->tid AND n.nid=t.nid ORDER BY n.created DESC");
+while ($nidvalue=db_result($res)){
+if($previous!=0 && $next==0) {
+$next=$nidvalue;
+}
+if($nidvalue == intval($node->nid)) {
+$previous=$tmp_prev;
+}
+$tmp_prev=$nidvalue;
+}
+$output .= '<div class="links">';
+if($previous>0) { $output .= "<a href=\"$base_url/node/$previous\"><< previous photo <<</a> "; }
+else $output .= "<< previous photo << ";
+$output .= " || ";
+if($next>0) { $output .= "<a href=\"$base_url/node/$next\">>> next photo >></a>"; }
+else $output .= ">> next photo >>";
+$output .= '</div><a name=pict></a><br>';
+return $output;
+}
+}
\ No newline at end of file