The image_info tag is a single tag that Textpattern will replace with the relevant image data from the current image. Should usually be used in an ‘image’ type form, although it may be used on its own providing you specify an id or name.
Tag will accept the following attributes (case-sensitive) as well as the global attributes :
- Escape HTML entities such as
- Values: See the tag escaping documentation for all possible values.
idassigned at upload of an image to display. The IDs can be found on the Images panel.
- Default: unset.
- An image to display, given by its image name as shown on the Images panel. If both
idare specified, the
- Default: unset.
- One or more of the following values to display the particular pieces of information from the current image.
author: image author’s login name (see image_author to display the author’s real name).
category: image category name.
category_title: image category title.
date: timestamp of image upload (this is not very useful, so consult image_date for a better alternative).
ext: image extension.
h: image height.
id: image id.
name: image name.
thumb_w: image thumbnail width.
thumb_h: image thumbnail height.
w: image width.
Example 1: Gallery thumbnail and caption
<txp:images category="mammals"> <txp:thumbnail /> <txp:image_info type="caption" wraptag="div" /> </txp:images>
Grabs all images from the ‘mammals’ category and displays the image thumbnail itself along with the image caption surrounded with HTML
<div> tags. Note that the image IDs/names are not specified inside the container because they are automatically assigned from the
<txp:images> tag for each image in the given category.
If you had multi-line captions separated by a blank line, you could pass the caption through the
textile filter to retain paragraph breaks:
<txp:image_info type="caption" wraptag="div" escape="textile" />
Example 2: Multiple pieces of information at once
<txp:images category="birds, mammals" thumbnail="1" sort="category asc"> <txp:if_different> <h4> <txp:image_info type="category_title" /> </h4> </txp:if_different> <txp:thumbnail wraptag="div" /> <txp:image_info type="w, h" wraptag="div" class="img-dimensions" break=" x " /> by <txp:image_info type="author" /> </txp:images>
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.
Example 3: Specific image information
<txp:image_info id="5" type="category_title" />
Displays the category_title of the category assigned to image ID ‘5’.
breakby attribute added.
breakclass attribute deprecated.
Tag support added.