Skip to content

Commit 8372fa0

Browse files
committed
Update txp:images tag docs for 4.9.0
1 parent 17b6211 commit 8372fa0

File tree

1 file changed

+35
-68
lines changed

1 file changed

+35
-68
lines changed

tags/images.md

Lines changed: 35 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ Tag will accept the following attributes (**case-sensitive**) as well as the {%
5858
`category="image category"`
5959
: Filter the images by this list of category names as defined in the Categories panel.
6060

61+
`exclude="attributes"`
62+
: List of IDs or attributes to 'negate'. For attributes, choose from one or more of: `name`, `category`, `author`, `realname`, `extension`, `size`, `month`, `time`, or `id`.
63+
6164
`extension=".extension"`
6265
: Filter the images by this list of image file extension(s), including the leading dot. Example: `extension=".avif, .jpg, .png, .webp"`.
6366
: **Default:** unset.
@@ -75,29 +78,38 @@ Tag will accept the following attributes (**case-sensitive**) as well as the {%
7578
: The order of the ids overrides the default `sort` attribute.
7679
: **Default:** unset.
7780

78-
`limit="integer"`
79-
: The number of images to display per page.
80-
: **Default:** `0` (unlimited).
81+
`month="date"`
82+
: Filter the images using this starting time point, e.g. `month="2025-10"` for all images with dates in October 2025.
83+
: See also: `time` attribute for further filtering range options.
84+
: **Default:** unset.
8185

8286
`name="image name"`
8387
: Filter the images by this list of image names as shown on the Images panel.
8488
: **Default:** unset.
8589

86-
`offset="integer"`
87-
: The number of images to skip.
88-
: **Default:** `0` (only effective if `limit` is set).
89-
90-
`pageby="integer" (or "limit")"`
90+
`pageby="integer" (or "limit")`
9191
: The number of images to jump forward or back when an [older](/tags/older) or [newer](/tags/newer) link is selected. Without this attribute, pagination is not available; you will simply see `limit` images. You may specify `pageby="limit"` to allow pagination to automatically follow the value of the `limit` attribute. Note: [newer](/tags/newer) and [older](/tags/older) will paginate all content types at once.
9292
: **Default:** unset.
9393

9494
`realname="author name"`
9595
: Filter the image list so it only includes images uploaded by this list of author real names. The author names may be URL encoded (e.g. `realname="John+Smith"`) and thus could be read from the current `example.com/author/author+name` URL. Note that this attribute may incur one extra query per name, so if it is possible to use the raw author instead it will be faster.
9696
: **Default:** unset.
9797

98-
`sort="sort value(s)"`
99-
: How to sort the resulting image list. Specify a value from the ones below, followed by a space and then add either `asc` or `desc` to sort in ascending or descending order, respectively.
100-
: **Values:** \\
98+
`size="portrait|landscape|square|value|ratio"`
99+
: Filter the image list so it only includes images matching certain dimensions. Use `portrait`, `landscape` or `square` to filter images with that aspect ratio. Alternatively, specify a single value to 2 decimal places of the desired aspect (e.g. 1.33 for 4:3) or a pair of values representing an aspect ratio such as `16:9`. Finally, by including just one 'side' of the aspect ratio, it's possible to filter by images with that particular dimension, e.g. `size="800:` would match all images with a width of 800px. Or `size=":1024"` would match all images with a height of 1024px.
100+
: **Default:** unset.
101+
102+
`thumbnail="number"`
103+
: Filter the image list to only include images that have a thumbnail of a certain type, or none.
104+
: **Values:** unset (i.e. all images), `2` (images that have automatic thumbnails), `1` (images that have a custom thumbnail) or `0` (images that do not have a thumbnail).
105+
: **Default:** unset.
106+
107+
`time="offset"`
108+
: Filter the images using this time range. e.g. `time="-1 month"` would find all images with timestamps within the last month of 'now'.
109+
: See also: `month` attribute to alter the starting point from which to apply the `time` offset.
110+
: **Default:** unset.
111+
112+
{% capture svals %}
101113
`alt`. \\
102114
`author`. \\
103115
`caption`. \\
@@ -111,40 +123,8 @@ Tag will accept the following attributes (**case-sensitive**) as well as the {%
111123
`thumb_h` (image thumbnail `height` attribute). \\
112124
`thumb_w` (image thumbnail `width` attribute). \\
113125
`w` (image `width` attribute).
114-
: **Default:** `name asc`.
115-
116-
`thumbnail="boolean"`
117-
: Filter the image list to only include images that have a thumbnail, or not.
118-
: **Values:** unset (i.e. all images), `1` (images that have a thumbnail) or `0` (images that do not have a thumbnail).
119-
: **Default:** unset.
120-
121-
### Common presentational attributes
122-
123-
These attributes, which affect presentation, are shared by many tags. Note that default values can vary among tags.
124-
125-
`break="value"`
126-
: Where value is an HTML element, specified without brackets (e.g. `break="li"`) or some string to separate list items.
127-
: **Default:** `br` (but see [break cross-reference](/tags/tag-attributes-cross-reference#break) for exceptions).
128-
129-
`breakby="integer"` <span class="footnote warning">v4.7.0+</span>
130-
: Used to group list items when separating by `break`. Possible values are lists of integers, like `2` (groups of 2 items) or `1,2` (alternate groups of 1 and 2 items).
131-
: **Default:** `1` (actually unset).
132-
133-
`class="class name"`
134-
: CSS `class` attribute to apply to the image (or to the `wraptag`, if set).
135-
: **Default:** tag name **or** unset (see [class cross-reference](/tags/tag-attributes-cross-reference#class)).
136-
137-
`label="text"`
138-
: Label prepended to item.
139-
: **Default:** unset (but see [label cross-reference](/tags/tag-attributes-cross-reference#label) for exceptions).
140-
141-
`labeltag="element"`
142-
: HTML element to wrap (markup) label, specified without brackets (e.g. `labeltag="h3"`).
143-
: **Default:** unset.
144-
145-
`wraptag="tag"`
146-
: HTML element to wrap (markup) list block, specified without brackets (e.g. `wraptag="ul"`).
147-
: **Default:** unset (but see [wraptag cross-reference](/tags/tag-attributes-cross-reference#wraptag) for exceptions).
126+
{% endcapture %}
127+
{% include atts-global.html class="tag name **or** unset" offset="0" limit="0" sort="name asc" sortvals=svals %}
148128

149129
## Examples
150130

@@ -259,13 +239,13 @@ All GIF images are displayed.
259239
<txp:images category="mammals, birds" thumbnail="1" />
260240
~~~
261241

262-
All images in the named categories that have thumbnails assigned to them are displayed.
242+
All images in the named categories that have custom thumbnails assigned to them are displayed.
263243

264244
~~~ html
265245
<txp:images thumbnail="1" />
266246
~~~
267247

268-
All images that have thumbnails assigned to them are displayed.
248+
All images that have custom thumbnails assigned to them are displayed.
269249

270250
~~~ html
271251
<txp:images thumbnail="0" />
@@ -288,30 +268,13 @@ All images that do not have thumbnails assigned to them are displayed.
288268
</txp:images>
289269
~~~
290270

291-
Shows the thumbnail of each image that has an assigned thumbnail image from the 'mammals' and 'birds' categories and, beneath each, show its dimensions 'width' x 'height' along with the author of the image. Since the list has been sorted by category, the `<txp:if_different>` conditional can be used to output the category title at the top of the list of images each time it changes.
271+
Shows the thumbnail of each image that has an assigned custom thumbnail image from the 'mammals' and 'birds' categories and, beneath each, show its dimensions 'width' x 'height' along with the author of the image. Since the list has been sorted by category, the `<txp:if_different>` conditional can be used to output the category title at the top of the list of images each time it changes.
292272

293273
Other tags used: [if_different](/tags/if_different), [image_info](/tags/image_info), [thumbnail](/tags/thumbnail).
294274

295-
### Example 3: Integration with third-party PHP resizing script (TimThumb)
296-
297-
[TimThumb](https://www.binarymoon.co.uk/projects/timthumb/) is a simple, flexible, PHP script that resizes images directly on your web server. [Read the TimThumb documentation](https://www.binarymoon.co.uk/2010/08/timthumb/) for basic installation instructions (also requires the GD image library). Then, for example, you can use the following:
275+
### Example 3: Dynamic srcset
298276

299-
~~~ html
300-
<txp:images limit="6" category="gallery">
301-
<p>
302-
<a href="<txp:image_url />" title="View original">
303-
<img src="<txp:site_url />timthumb.php?src=<txp:image_url />&amp;w=160" alt="<txp:image_info type='alt' />">
304-
</a>
305-
</p>
306-
<p>
307-
Author: <txp:image_author />
308-
</p>
309-
</txp:images>
310-
~~~
311-
312-
Creates a small gallery of 6 images from the category 'gallery'. Uses the TimThumb script to proportionately resize a thumbnail version (160px wide) of the image automatically, and keep a cached version of the thumbnail for future visitors. Links the thumbnail to the original image, and lists the image author name below each thumbnail.
313-
314-
Other tags used: [image_author](/tags/image_author), [image_info](/tags/image_info), [image_url](/tags/image_url), [site_url](/tags/site_url).
277+
TBD.
315278

316279
### Example 4: Using offset and limit for news pages
317280

@@ -331,12 +294,16 @@ And then later on you could drop in…
331294
</txp:images>
332295
~~~
333296

334-
…to display the three remaining supporting images as thumbnails in a gallery, all taken from the Article Image field.
297+
…to skip the first and display the three remaining supporting images as thumbnails in a gallery, all taken from the Article Image field.
335298

336299
Other tags used: [article_image](/tags/article_image), [thumbnail](/tags/thumbnail).
337300

338301
## Genealogy
339302

303+
### Version 4.9.0
304+
305+
`thumbnail` attribute extended to automatic thumbs (`2`).
306+
340307
### Version 4.7.0
341308

342309
`breakby` attribute added.

0 commit comments

Comments
 (0)