<txp:images /> sing/cont tag, 19 attributes

images

The images tag is a single or container tag that Textpattern will use to gather a list of matching images uploaded via the TXP Images (panel). Utilising the other image tags in the suite image_info, image_url, image_date and if_thumbnail) you can display simple image galleries from this list.

If used as a container tag, it must be specified as an opening and closing pair of tags, like this:

<txp:images>
...contained statements...
</txp:images>

This is equivalent to putting the contained statements into a form named “my_form” and using <txp:images form=“my_form” />.

By default, the tag is context-sensitive, which means that in the absence of any other filter attributes (id, name, category, author, realname, extension, thumbnail), it will grab a list of image IDs from the currently viewed article’s article_image field. If it finds nothing there, it will check the URL to see if there is a category list in progress. If it finds nothing there too, the tag will display nothing. See the auto_detect attribute for further information.

attributes

id="unset" (integer) 
  • Filter the images by this list of ids assigned at upload. The IDs can be found on the Images (panel).
name="unset" 
  • Filter the images by this list of image names as shown on the Images (panel).
category="unset" 
  • Filter the images by this list of category names as defined in the Categories tab.
author="unset" 
  • Filter the images by this list of author IDs who uploaded the pictures to Textpattern.
realname="unset" 
  • 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 site.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.
extension="unset" 
  • Filter the images by this list of image extensions, including the leading dot. Example: extension=”.jpg, .png”
thumbnail="unset" 
  • Filter the image list to only include images that have a thumbnail (1) or not (0).
label="unset" 
  • Text to display above the list of images as a label.
labeltag="unset" 
  • HTML tag to be used to wrap the label, specified without brackets.
wraptag="unset" 
  • HTML tag to be used to wrap the img tag, specified without brackets.
html_id="unset" 
  • The HTML id attribute applied to the wraptag, if set, otherwise to the img tag.
class="unset" 
  • CSS class attribute applied to the wraptag, if set, otherwise to the img tag.
break="br" 
  • The (X)HTML tag (without brackets) or string to separate each image.
limit="0" (integer) 
  • The number of images to display per page.
offset="0" (integer) 
  • The number of images to skip.
pageby="unset" (integer or "limit") 
  • The number of images to jump forward or back when an older or newer link is clicked. 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 and older will paginate all content types at once.
sort="name asc" 
  • Values
    • id (image id#)
    • name (image name)
    • category
    • extension (image extension)
    • author
    • alt
    • caption
    • date
    • w (image width)
    • h (image height)
    • thumb_w (image thumbnail width)
    • thumb_h (image thumbnail height)
    • rand() (random)
  • Direction
    • asc (ascending)
    • desc (descending)
form="unset" 
  • Use specified form for each image. If not used, and the container is empty, the tag will output a list of images that are compatible with image_display.
auto_detect="article, category, author" 
  • List of Textpattern contexts to consider when automatically searching for images. If you wish to turn off the automatic check, set this to auto_detect=”“. You can choose from the following contexts:
    • article to look in the article_image field
    • category to look in the URL for a category list
    • author to look in the URL for an author list

genealogy

Version 4.3.0

  • tag introduced
<txp:images /> 18 examples

Default usage

<txp:images />

Uses the current article image field as a list of image IDs. If the article image field is empty, it contains names/URLs, or the tag is used on an article list page, it returns no images. If, however, the tag is used on a category list page (e.g. category/image/photos) then the photos category would be used

Displays all images in the database

<txp:images auto_detect="" />

No images displayed

<txp:images id="" /> 
<txp:images name="" /> 
<txp:images category="" />

This means that if you did some tag-in-tag magic such as : category=’<txp:custom_field name=“my_cats” />’ it will show no images if the custom field is empty.

Display images 2, 3, and 6

<txp:images id="2,3,6" />

Display named images

<txp:images name="lion.jpg, zebra.jpg" />

No images are displayed (mis-spelled image name)

<txp:images name="pengiun.jpg" />

Display images in the named categories

<txp:images category="mammals, birds" />

Display all images in the named categories and any uncategorized images

<txp:images category=", mammals, birds" />

Display uncategorized images

<txp:images category=" " />

Note that category=”,” also works, but a space looks better.

Display images by author (ID)

<txp:images author="attenborough, morris" />

Display all images by author

<txp:images realname="David+Attenborough" />

This incurs one extra query to look up the author’s ID from the given real name.

Display images in the named categories and authors

<txp:images category="mammals, birds" author="attenborough, morris" />

Display all jpg images in the named categories

<txp:images category="mammals, birds" extension=".jpg" />

Display all jpg images in the named categories and authors

<txp:images category="mammals, birds" extension=".jpg" author="attenborough, morris" />

Display all GIF images

<txp:images extension=".gif" />

Display all images in the named categories that have thumbnails

<txp:images category="mammals, birds" thumbnail="1" />

Display all images that have thumbnails

<txp:images thumbnail="1" />

Display all images that do not have thumbnails

<txp:images thumbnail="0" />