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:
- Create a new Page called something like ‘photo_page’
- Create a new section called something like ‘photo’, and tell it to use ‘photo_page’.
- 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.
- 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:
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:
- name: the name of our image in the TXP image section. [must be specified, if no id attribute present]
- id: the id of our image in the TXP DB. [must be specified if no name attribute present.]
- poplink: give this any not 0 value – for example poplink=”1” – if you want to create a link to a popup window with the image which thumbnail is asociated.
- This tag can takes also the XHTML attributes style and align.
Note that if both name and id attributes are present at once, the name value will override the id one.
* * *