I have a product content type which allows for uploading of multiple images via a CCK Imagefield and Imagecache. I'm using Views to then show listings of these product content types and for the product images, I am using Lightbox2 setup with a preset as "product_image_small->original compact". This allows me to display only the first image in the group in the view and then open a lightbox showing all images in the group at their original size.

This all works fine but I would like to additionally add a link in my view such as "View more images" that also opens up the same lightbox as when I click on the image thumbnail just in case it's not intuitive for someone to know to click the image.

I am theming the view and outputting the thumbnail with a lightbox is as simple as printing the image value returned from views such as:

print $fields['field_image_cache_fid']->content;

This outputs a single thumbnail image that is lightbox enabled to show all images in the group when clicked. Looking at the raw HTML source output, I see something similar to the following:

<a class="imagefield imagefield-lightbox2 imagefield-lightbox2-product_image_small imagefield-field_image_cache imagecache imagecache-field_image_cache imagecache-product_image_small imagecache-field_image_cache-product_image_small lightbox-processed" rel="lightbox[field_image_cache][China Cabinet]" href="http://www.example.com/sites/default/files/ccc03204_0.jpg">
<img width="100" height="100" title="" alt="China Cabinet" src="http://www.example.com/sites/default/files/imagecache/product_image_small/ccc03204_0.jpg">
</a>

for the first image in the group and the others are similar except obviously have different image filenames as well as don't have a thumbnail image displayed in the link. I tried simply dumping hardcoded copies of the HTML into my view template and it only displays the full image on a new page rather than opening a lightbox.

How can I then add a simple text link such as "View more images" to my view that will open up and display the same lightbox of images as my thumbnail? Is this something that is possible?

Thanks

Comments

yukare’s picture

Try removing the class "lightbox-processed".

Fernando Correa da Conceição
http://jaguaribe.net.br

jastylr’s picture

Awesome! That was truly a simple fix. Lightbox pops up now.

Thanks