Before I go into the actual problem, let me give you a little bit of a background which I think is necessary as a couple of modules play together and I am not sure where I have to do the modification. I apologize for this lengthy post.

My end goal is to have a few thumbnail images and when clicking on them, a photo gallery should open in a lightbox. I got pretty close to the desired results using the following setup:

CKK with ImageField module: 1 content type "gallery" which contains a title and one ImageField that allows multiple entries.

ImageCache module: 2 presets, one for thumbnails, one for the larger view in the gallery.

Views module: a block view that is filtered on the content type "gallery" and contains the fields "title" and the imagefield (with multiple images per field). The imagefield is set to use the format "Lightbox2 (thumbnail -> full size image)".

The view does almost what I want: it lists all images with their node titles and when clicking on an image, the lightbox comes up and allows me to flip through all the images I have per node. This current setup can be looked at here: http://rattangalerie.ennovations.net/lbtest (the nodes are node/21 and node/22).

And now the problem...
The only thing that is not how I want it, is the fact that the view lists all images of the imagefield. I would like to see only the first thumbnail and then when clicking on that thumbnail, the Lightbox should come up allowing the user to flip through the rest of the images:

Node 1's Imagefield has 4 images. The first one should be visible, the rest through the lightbox only.

Node 2's Imagefield has 3 images. Again, the first one should be visible (next to the thumbnail from node 1) and the other 2 pictures from this node should be visible in a lightbox again.

What I tried...
I created a row template file (views-view-fields--lbview2.tpl.php) to get access to the ImageField field. Using $fields['field_lbphoto2_fid'], I did get access to the field but I am not able to pull the images separately, only the complete markup for all fields together using ($fields['field_lbphoto2_fid']->content). I further noticed that no file_path field is populated, which probably has to do with using the ImageCache to render the image? The logic that I did want to put in here is as follows:

1. Get the complete markup (with link, style, etc.) of just the first image of the ImageField. Write it out.
2. For the remaining pictures of the same ImageField, get the link markup (generated by Lightbox2 I assume) and inject a CSS class called "hidden".
3. In the stylesheet implement a.hidden (= hide the images using display:none)

This setup would be a variation of the following, Lightbox2 related comment:
http://drupal.org/node/274487#comment-1154213 ($item[filepath] is not available in my view for the image field)

Any help would be highly appreciated.

Thank you,
Dennis

Comments

Heather51’s picture

Did you uncheck "Group multiple values" in the view for the cck field. Also, is the node distinct value set to distinct? This helped me with a similar problem. If you set the pager to "no" it will only show you the first image in the node.