diff -ruN image.orig/image.css image/image.css --- image.orig/image.css Fri Apr 15 16:14:52 2005 +++ image/image.css Sat May 28 23:56:41 2005 @@ -35,4 +35,29 @@ ul.images li { float : left; margin : 1em; -} \ No newline at end of file +} + +.image_view .nav { + padding-bottom: 1em; + clear: both; +} + +.image_view .nav .links { + clear: both; +} + +.image_view .nav .titles { + clear: both; +} + +.image_view .nav .prev { + float: left; + text-align: left; + width: 45%; +} + +.image_view .nav .next { + float: right; + text-align: right; + width: 45%; +} diff -ruN image.orig/image.module image/image.module --- image.orig/image.module Sat May 28 09:09:40 2005 +++ image/image.module Sat May 28 23:58:06 2005 @@ -77,13 +77,18 @@ $rows[] = $row; } $header = array(t('Label'), t('Width'), t('Height')); - $size_group .= form_item(NULL, theme('table', $header , $rows), t('Select various pixel dimensions, "thumbnail" and "preview" are required.')); + $size_group .= form_item(NULL, theme('table', $header , $rows), t('Select various pixel dimensions, "minithumb", "thumbnail" and "preview" are required.')); $size_group .= form_checkbox(t('Allow users to view original image'), 'image_view_original', 1, variable_get('image_view_original', 0)); $output.= form_group(t('Image sizes'), $size_group); $gallery_group = form_textfield(t('Images per page'),'image_images_per_page', variable_get('image_images_per_page',6),3,3,t('Sets the number of images to be displayed in a gallery page.')); $output .= form_group(t('Gallery settings'), $gallery_group); - + + // Navigation settings + $nav_group .= form_checkbox(t('Show gallery navigation'), 'image_nav_show', 1, variable_get('image_nav_show',1)); + $nav_group .= form_checkbox(t('Show thumbnails (minithumb)'), 'image_nav_show_thumbs', 1, variable_get('image_nav_show_thumbs',1)); + $output .= form_group(t('Navigation settings'), $nav_group); + return $output; } @@ -180,7 +185,7 @@ if ($type == 'node' && $node->type == 'image' && !$main) { $sizes = array(); foreach (_image_get_sizes() as $size) { - if ($size['label'] && !in_array($size['label'], array('thumbnail', '_original'))) { + if ($size['label'] && !in_array($size['label'], array('minithumb', 'thumbnail', '_original'))) { $sizes[] = $size; } } @@ -285,11 +290,16 @@ } $request = ($_GET['size']) ? $_GET['size'] : 'preview'; $node = node_prepare($node, $main); + if (variable_get('image_nav_show', 1)) { + $prev = 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 = %d AND (n.sticky < %d OR (n.sticky = %d AND (n.created < %d OR (n.created = %d AND n.nid < %d)))) AND n.nid != %d AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC, n.nid DESC'), $p->tid, $node->sticky, $node->sticky, $node->created, $node->created, $node->nid, $node->nid, 0, 1)); + $next = 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 = %d AND (n.sticky > %d OR (n.sticky = %d AND (n.created > %d OR (n.created = %d AND n.nid > %d)))) AND n.nid != %d AND n.status = 1 ORDER BY n.sticky ASC, n.created ASC, n.nid ASC'), $p->tid, $node->sticky, $node->sticky, $node->created, $node->created, $node->nid, $node->nid, 0, 1)); + if ($prev) $prev = node_load(array('nid' => $prev->nid)); + if ($next) $next = node_load(array('nid' => $next->nid)); + } $node->teaser = l(image_display($node, 'thumbnail'), 'node/'.$node->nid, array(), NULL, NULL, FALSE, TRUE) . $node->teaser; - $node->body = image_display($node, $request) . $node->body; + $node->body = theme('image_view', image_display($node, $request), $node->body, $prev, $next); } - /** * Implementation of hook_load */ @@ -300,6 +310,9 @@ $node->images[$file->filename] = $file->filepath; } // special images + if (empty($node->images['minithumb'])) { // use thumbnail if minithumb doesn't exist + $node->images['minithumb'] = $node->images['thumbnail']; + } if (empty($node->images['thumbnail'])) { $node->images['thumbnail'] = $node->images['_original']; } @@ -489,6 +502,53 @@ } /** + * Theme an image node's previous and next links + */ +function theme_image_view($image_html, $description, $prev, $next) { + $content = ''; + + if (variable_get('image_nav_show', 1)) { + drupal_set_html_head(''); + if($prev) { + if (variable_get('image_nav_show_thumbs', 1)) { + $links .= ''; + } + $titles .= ''; + } + else { + $links .= ''; // Make an empty div to fill the space. + } + + if($next) { + if (variable_get('image_nav_show_thumbs', 1)) { + $links .= ''; + } + $titles .= ''; + } + else { + $links .= ''; // Make an empty div to fill the space. + } + } + + $content .= '
'; + $content .= $image_html; + $content .= $description; + if (variable_get('image_nav_show', 1)) { + $content .= ''; + } + $content .= '
'; + + return $content; +} + +/** * Theme a gallery page */ function theme_image_gallery($galleries, $images) { @@ -642,12 +702,13 @@ * Helper function to return the defined sizes (or proper defaults). */ function _image_get_sizes() { - return variable_get('image_sizes', array(array('width' => 100, 'height' => 100, 'label' => t('thumbnail')), + return variable_get('image_sizes', array(array('width' => 100, 'height' => 100, 'label' => t('minithumb')), + array('width' => 100, 'height' => 100, 'label' => t('thumbnail')), array('width' => 640, 'height' => 640, 'label' => t('preview')))); } function _image_required_sizes() { - return array('thumbnail', 'preview', '_original'); + return array('minithumb', 'thumbnail', 'preview', '_original'); } function _image_get_dimensions($label) {