Image Tags · 8.06.04

You can easily build your photo galleries using textpattern, even though image tags are not in TEXTPATTERN TAG BUILDER yet.

Next instructions are stolen directly from Textpattern Forum (thanks Dean):

First, you must upload fullsize images and corresponding thumbnails, and make sure each is in a specific category (keep the image category names simple: without spaces if possible, ‘newyear_2004’ for example).

To make an image gallery page:

  1. Create a new Page called something like ‘photo_page’
  2. Create a new section called something like ‘photo’, and tell it to use ‘photo_page’.
  3. In photo_page, put the tag <txp:image_index /> wherever you want the index to appear: a good idea would be to use a <div> and CSS to govern the space available for the index, and how the <img /> tags should be positioned.
  4. Wherever you want the fullsize image to appear on the page, put a <txp:image_display /> tag.

Then to call the gallery page (provided it is in the section ‘photo’), use:

your-txp-site.com/photo/?c=IMAGECATEGORY

At the same forum post you can find also 2 easy to use templates.

Now, a small description of these two tags:

The <txp:image_index /> tag

This tag will output a list containing all the thumbnails for a given category of images in our TXP installation. Of course, our images need to have a thumbnail, in order to display them on this index.

You can specify the attribute c to this tag in order to specify a default category for the images you want to display. If you don’t specify it, you need to pass to your image pages, at the end of the url, ?c=IMAGECATEGORY, where IMAGECATEGORY is the category of the images you want to show.

The <txp:image_display /> tag

Once we’ve created our image index, we can place this tag anywhere on the page, to show the image pointed by the thumbnails.

The <txp:thumbnail /> tag

[Avaliable since γ1.19]

Whith this tag we can output one of the thumbnails on our TXP image section anywhere in our pages. Of course, that thumbnails must exists in order to be displayed.

This tag can takes the next attributes:

Note that if both name and id attributes are present at once, the name value will override the id one.

* * *

Comment

  1. Hi!
    Message from a newbie: thanks for this VERY useful manual.
    If I’ve got it right, then to create a special ‘photo’ section, I need an .htaccess file, yes? This means that it’ s impossible to create an image gallery in this way if TXP runs in messy mode, is it correct? My provider doesn’t allow .htaccess files with an allow_override rule… That’s why I ask.
    macubu    26 04 2004 - 01:25    #
  2. It’s not possible; from now. But I’m conscious that it’s on the TO-DO list on a very important place.
    kusor    8 06 2004 - 17:17    #

commenting closed for this article

« Article Related Tags | Article Form Tags »