Is it possible to make "Next" and "Previous" buttons in image pages? Having to go back to the gallery and then selecting the next picture is somewhat of a hassle in large galleries.

Comments

dreed47’s picture

You might want to check out http://drupal.etopian.net/image_module. I have not tried it yet but it looks like it provides the next and previous image links as well as showing the next and previous image thumbnails. I have an idea of how to provide this with the stock image module (without thumbnails) but I have not had time to implement it yet.

sami_k’s picture

That is exactly what that patched version does, the patches are also available here if the module developer would like to make that standard functionality.

rogue_77’s picture

Component: image_gallery » image.module
Status: Closed (won't fix) » Active

I'm looking for this feature and I tried that link to drupal.etopian.net/image_module and its broken. I would have to say this is a fair request for an almost essential feature for an image gallery.

drewish’s picture

Component: image.module » image_gallery

I marked http://drupal.org/node/120548 as a duplicate of this.

koorneef’s picture

Status: Active » Closed (fixed)

This can be done with the phptemplate theme functionality, see: http://drupal.org/node/45050

halftone’s picture

Unfortunately those additions don't work with images that use multiple taxonomies. You get very unpredicatble results with next & prev images being pulled from unexpected categories. Please, please someone fix this as a normal part of the image module.

drewish’s picture

Status: Closed (fixed) » Active

yeah i agree this shouldn't be done at the theme level.

brunodbo’s picture

Is someone currently working on this?

halftone’s picture

You might want to look at http://drupal.org/node/119052#comment-214489 (and the preceding msgs) - a custom module that provides a pager on image nodes, works with the Nodeorder module http://drupal.org/project/nodeorder- allowing an explicit ordering of images.

The pager also respects multiple taxonomy terms for images, where they exist Every other pager I have tried gets confused by images that inhabit multiple terms, hopping from one term to another and jumbling sequences.

It needs a couple of hacks to image.module to work, but defaults to normal Drupal sticky+upload date ordering if Nodeorder is not present,. In instances where no term is specified, eg coming from a random or latest image block, it simply uses the first.

IWNBI it could perhaps be incorporated into the image.module distribution as a contrib module, as next|prev and ordering of images is such a FAQ, but I'm not competent to say whether it's wholesome code.

designwork’s picture

Hi

I found this pager some where it works for me, maybe it is a stating point.

function custom_pager($current_nid, $class = NULL) {
$tid = reset(array_keys(taxonomy_node_get_terms($current_nid)));
$result = db_query(db_rewrite_sql('SELECT n.nid, n.title FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE tn.tid = %s AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC, n.nid DESC'), $tid);
while ($node = db_fetch_object($result)) {
$nodes[++$i] = $node;
if ($node->nid == $current_nid) $x = $i;
}
if($x > 1) {
$output .= l('« erstes', 'node/'. $nodes[1]->nid, array('title' => check_plain($nodes[1]->title), 'class' => $class), NULL, NULL, FALSE, TRUE);
$output .= l('‹ voriges', 'node/'. $nodes[$x-1]->nid, array('title' => check_plain($nodes[$x-1]->title), 'class' => $class), NULL, NULL, FALSE, TRUE);
}
$output .= $x .' von '. $i;
if($x < $i) {
$output .= l('naechstes ›', 'node/'. $nodes[$x+1]->nid, array('title' => check_plain($nodes[$x+1]->title), 'class' => $class), NULL, NULL, FALSE, TRUE);
$output .= l('letztes »', 'node/'. $nodes[$i]->nid, array('title' => check_plain($nodes[$i]->title), 'class' => $class), NULL, NULL, FALSE, TRUE);
}
return $output;
}

Dirk

underpressure’s picture

Any update on the status of this feature?

halftone’s picture

This feature has been requested umpteen times since I first began using Drupal @ v4.5. I (and lots of others too) couldn't imagine why such a basic piece of functionality was missing. However, a few years down the line I think there is a reasonable excuse, that what people actually want varies. You'll find a large number of user-contributed solutions in the forums. eg

http://drupal.org/node/119052
http://drupal.org/node/45050
http://drupal.org/node/98883

I'm using http://drupal.org/node/119052#comment-256393 which gives a pager type display and works with the Nodeorder module and multi-taxonomies, but that's with Drupal 4.7. After months of struggling to achieve what I wanted I'm terrified of breaking this, it's a principal reason why I have not upgraded Drupal.

Really, IMO the image pager/next-prev stuff wants implementing in a separate module with a variety of config options, that could then be part of the image module distribution in the same way that image_gallery is. I'm not competent to code it else I would. However osherl's custom module (the root of the above thread) should provide a flying start for a developer motivated enough to do it.

Regards
Tony Sleep http://tonysleep.co.uk

Hetta’s picture

I quite like my solution: make a blank (or explanatory, or whatever) book page, use "Outline" to add your photos to that book page => you get prev / up / next, all in one neat package.
As an added bonus, that prev/next is ordered alphabetically, not using the pretty random "last upload shows first, first upload shows at the tail end" of image gallery.

Piece of cake.

psiska’s picture

Hi guys

My solution is pretty simple, bet somewhere out there is a similar one, check out http://drupal.org/node/181021

Hetta’s picture

Marked http://drupal.org/node/214714 as duplicate - although that issue tells you that views + one or the other additional views module will give you paging.

sami_k’s picture

Status: Active » Closed (won't fix)

Closing issue as solutions above are acceptable. If someone wants to code up a module, by all means go ahead.

halftone’s picture

I take your point that the 'next-prev' solution is better realised as a module, but as mentioned at #9 adding support for multiple taxonomies and the Nodeorder module, if present, would be far better than having to hack image_gallery.module, and is rather necessary groundwork for any useful image pager module. If I was competent to submit a patch I would have done it ages ago but I struggle to apply patches let alone make them.

I have working 4.7 hacked code for image_gallery, and part-amended 5.n (only Nodeorder done so far), also a basic image_page_pager module for 4.7 that I need to try and redo for 5.n. So there is the basis of a module - but it's of limited use given it relies on deplorable hacks to image_gallery. How do I progress this? Open another issue? Sorry to seem so clueless.

Hetta’s picture

Have you tried #15?

halftone’s picture

No, but that is not going to cope with images that inhabit multiple terms of a taxonomy (it'll only use the first term), nor Nodeordered images. The 4.7 solution outlined at http://drupal.org/node/193056 handles both.

Ultimately, whatever means is used to provide a pager - and I am happy to accept that requirements and solutions will vary there - image_gallery_module needs to have breadcrumbs that can cope with multiple taxonomy terms and to support Nodeorder, else module hacking is unavoidable if the user wishes to use either. Neither of the code changes to image_gallery functions change default behaviour, it still works exactly as normal if only a single term is used or Nodeorder is not installed.

Status: Active » Closed (won't fix)