Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-08-24 15:56:26

tumain
Member
From: UK
Registered: 2011-07-29
Posts: 12
Website

RESOLVED: Gallery with full-sized images

I’m a bit embarassed to ask this really, since it seems like such an easy thing to do and the answer is likely to be something easy too.

Basically, I’m just trying to display full-size images from a particular image category, not thumbnails, no hyperlinks, but just in full size.

I tried:

<txp:images category="<txp:custom_field name="gallery" />" thumbnail="0" />

But that just tried to display the thumbnail of an image from the category (the image has no thumbnail so it just showed as a broken image with a hyperlink).

Any help is appreciated, thanks.

Last edited by tumain (2011-08-24 16:29:20)

Offline

#2 2011-08-24 16:18:30

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

Re: RESOLVED: Gallery with full-sized images

Tags within tags requires single quotes. The thumnail attribute on txp:images is used to request images that do or do not have a thumnail. txp:image is what you need I believe.

Maybe this will give you the results you want?

<txp:images category='<txp:custom_field name="gallery" />'>
<txp:image thumbnail="0"/>
</txp:images>

From the wiki

Filter the image list to only include images that have a thumbnail (1) or not (0).

Last edited by MattD (2011-08-24 16:20:49)


My Plugins

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

Offline

#3 2011-08-24 16:18:54

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,946
Website GitHub

Re: RESOLVED: Gallery with full-sized images

tumain wrote:

display full-size images from a particular image category

I think you’re very close but a couple of things might have tripped you up:

  1. By default — without a form or container — <txp:images /> renders thumbnail links to full size images.
  2. The thumbnail attribute picks images from your database that either do or don’t have thumbnails thumbnail="0" in your case is superfluous because you don’t have any thumbnails assigned.
  3. If you’re embedding tags-in-tags you need to do use single quotes around the contained tag.

The upshot is that this is probably closer to what you want:

<txp:images category='<txp:custom_field name="gallery" />'>
   <txp:image />
</txp:images />

Two further things to keep in mind:

  1. if you are putting the above directly into an article, Textile might get in the way so you may need to escape the tags by wrapping the code in double-equals signs (or turning off Textile for that article from Advanced Options on the left)
  2. if your gallery custom field is ever empty, your tag will show all images. You can defend this situation by wrapping the above with a <txp:if_custom_field name="gallery"> tag.

Hope some of that helps.

EDIT: MattD was faster

Last edited by Bloke (2011-08-24 16:19:22)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#4 2011-08-24 16:28:40

tumain
Member
From: UK
Registered: 2011-07-29
Posts: 12
Website

Re: RESOLVED: Gallery with full-sized images

Yay. Thanks for the help Matt and Stef. :-) It works perfectly now.

Thanks for reminding me about those single quotes; I forgot about them. I’m using that <txp:if_custom_field name="gallery"> tag too. I just forgot to mention it.

Still can’t believe how quickly you both answered the question. :D

Offline

Board footer

Powered by FluxBB