image info
From Textbook
<txp:image_info />
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 form, although it may be used on its own providing you specify an id or name.
Contents |
Attributes
Tag will accept the following attributes (case-sensitive):
- id="integer"
- An
idassigned at upload of an image to display. The IDs can be found on the Images tab. - Default: unset.
- name="image name"
- An image to display, given by its image name as shown on the Images tab. If both
nameandidare specified, the id takes precedence. - Default: unset.
- type="information type"
- One or more of the following values to display the particular pieces of information from the current image:
-
id -
name -
category -
category_title -
alt -
caption -
ext(image extension) -
author(login name: see image_author to display the author's real name) -
w(image width) -
h(image height) -
thumb_w(image thumbnail width) -
thumb_h(image thumbnail height) -
date(timestamp of image upload: this is not very useful so consult image_date for a better alternative)
-
- Default:
caption. - wraptag="tag text"
- (X)HTML tag to wrap the items grabbed from the type attribute, specified without brackets.
- Default: unset.
- class="class name"
- CSS
classattribute applied to thewraptag. - Default: unset.
- break="tag text"
- The (X)HTML tag (without brackets) or string to separate each type item.
- Default: unset.
- breakclass="class name"
- CSS
classattribute applied to each break tag. - Default: unset.
- escape="html"
- Escape HTML entities such as
<,>and&for the given types. - Values:
htmlor unset. - Default:
html
Examples
Example 1: Gallery thumbnail and caption
<txp:image_list category="mammals"> <txp:thumbnail /> <txp:image_info type="caption" wraptag="div" class="img_cap" /> </txp:image_list>
- What it does...
- Grabs all images from the mammals category and displays the image thumbnail itself along with the image caption surrounded with
<div class="img_cap">...</div>tags. Note that the image IDs/names are not specified inside the container because they are automatically assigned from the<txp:image_list>tag for each image in the given category.
Other tags used: image_list, thumbnail
Example 2: Multiple pieces of information at once
<txp:image_list 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_dims" break=" x " />
by <txp:image_info type="author" />
</txp:image_list>
- What it does...
- 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.
Other tags used: image_list, thumbnail, if_different
Example 3: Specific image information
<txp:image_info id="5" type="category_title" />
- What it does
- Displays the category_title of the category assigned to image ID 5.
Genealogy
Version 4.3.0
- tag introduced




