Hello!

This is my first attempt to contribute something, so please be forgiving if I do something stupid.

My issue: I am using Node Gallery. I made a View which listed the image nodes that belonged to a specific gallery, and set the images to be displayed with a Lightbox2+Imagecache preset. Works perfectly, but when I have more than one such View rendered on the same page (i.e. a list of galleries and their images), the Lighbox will pick up all the images on the page, and won't be restricted to galleries. This happens due to the "rel" attribute using only the CCK field name that holds the image - makes perfect sense, but all the images are stored using the same field, so they are all in the same bucket.

Hackish (?) solution: I altered the theme_imagefield_image_imagecache_lightbox2() function so that it tries to find the Gallery ID of the image being rendered and add that ID to the "rel". This seems to work if the ID is the first tag in the "rel" (i.e. rel="lightbox[169][field....]").

Things that may bite back: I'm not checking whether $node->gid (the assumed Gallery ID of an image node) is truly a gallery ID, or not even if the Node Gallery module exists. I'm only checking if $node->gid is there, and add it to the "rel" if it is.

Hope this helps, even if a little bit. If my description wasn't clear enough, I'll provide the requested details.

Thanks for the excellent Lightbox2 module, and for Drupal as a CMS!

CommentFileSizeAuthor
group_by_node_gallery.patch522 bytestheresonant
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

theresonant’s picture

Small idea, just suggesting:

How about defining a "rel"-building hook? The $rel could be an array, and after the theme function builds it, it invokes the hook so modules can alter it. Some parameters passed to the hook could be the $node, $field_name etc. I could do this it if it's fine. Also, by doing it this way, other modules will be able to group the images based on the weirdest conditions.

Node Gallery may then provide the functionality that I described in the issue, since it's basically "how Lightbox2 would display the images I handle" (where I is Node Gallery).

Would this hurt performance too much?

pixelcab’s picture

Possible quick solution

I ran into the same grouping issue when displaying multiple galleries on a page. The issue was solved by changing the grouping on the Lightbox2 configuration page, under CCK display setting to "Group by field name and node id".

Hopefully this could be a quick fix to your grouping by node issues you may run into.