Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-03-30 22:25:08

rhino
New Member
Registered: 2011-02-12
Posts: 5

grouping images for use with a lightbox

I am wondering the best way to go about performing the following task:

I have a bunch of images that will all belong to the category “gallery”. Now on my gallery page, I want to pull all images associated with the “gallery” category to the page and wrap them with a link to the image itself.

For instance, the output for one of those images I want to look like this:

<a href=“images/test_image.png” class=“image-grouping”> <img src=“images/test_image.png” width=“100” height=“100” alt=“testing image” />
</a>

the image inside the anchor tag should be a small version of it, say 100×100 px. I want the href pointed to the url for that image and I want to give it a class. This is because this is how Fancybox operates.

Now how do I get this to dynamically happen?

I was looking at the if_article_image, however at the moment I have no article associated with the gallery page. The <txp:images /> tag just loads the images in, without giving me the ability to wrap them or add classes or any of that.

Can anyone help me solve this, any and all help is appreciated. Thanks!

Offline

#2 2011-03-30 23:17:53

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: grouping images for use with a lightbox

This will do what you need.

<txp:images category='gallery'>
        <a href="<txp:image_url/>" class="image-grouping"><txp:thumbnail /></a>
</txp:images>

You could also use a form with the txp:images tag like this:

<txp:images category='gallery' form='gallery-form' />

with a form named “gallery-form” contains:

<a href="<txp:image_url/>" class="image-grouping"><txp:thumbnail /></a>

Last edited by MattD (2011-03-30 23:21:47)


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#3 2011-03-30 23:21:08

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: grouping images for use with a lightbox

Here’s the code I’m using for a shadowbox gallery, adapt it to your needs:

<div class="gallery">
<ul><txp:images break="" category="some-category">
<li><a rel="shadowbox[group]" href="<txp:image_url />" title="<txp:image_info type="caption" />"><img src="<txp:image_url thumbnail="1" />" width="<txp:image_info type="thumb_w" />" height="<txp:image_info type="thumb_h" />" alt="<txp:image_info type="alt" />" /></a></li>
</txp:images></ul>
</div>

Edit: Matt was faster, and his code looks simpler ;)

Last edited by els (2011-03-30 23:23:29)

Offline

#4 2011-03-30 23:39:10

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: grouping images for use with a lightbox

Els wrote:

Matt was faster, and his code looks simpler ;)

I always forget about txp:thumbnail because it doesn’t start with “image” and I never see it when browsing the tag reference


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#5 2011-03-30 23:59:38

rhino
New Member
Registered: 2011-02-12
Posts: 5

Re: grouping images for use with a lightbox

Thank you all so much, that looks like my answer!

Offline

#6 2011-03-31 00:04:53

rhino
New Member
Registered: 2011-02-12
Posts: 5

Re: grouping images for use with a lightbox

Thanks again

Last edited by rhino (2011-03-31 05:25:41)

Offline

Board footer

Powered by FluxBB