<txp:image_info /> single tag, 8 attributes

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.

attributes

id="unset" (integer) 
  • An id assigned at upload of an image to display. The IDs can be found on the Images tab.
name="unset" 
  • An image to display, given by its image name as shown on the Images tab. If both name and id are specified, the id takes precedence.
type="caption" 
  • Values to display 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)
wraptag="unset" 
  • (X)HTML tag to wrap the items grabbed from the type attribute, specified without brackets.
class="unset" 
  • CSS class attribute applied to the wraptag.
break="unset" 
  • The (X)HTML tag (without brackets) or string to separate each type item.
breakclass="unset" 
  • CSS class attribute applied to each break tag.
escape="html" 
  • Escape HTML entities such as <, > and & for the given types.
  • Values: html or unset.

genealogy

Version 4.3.0

  • tag introduced
<txp:image_info /> 3 examples

Gallery thumbnail and caption

<txp:images category="mammals">
  <txp:thumbnail />
  <txp:image_info type="caption" wraptag="div" class="img_cap" />
</txp:images>

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:images> tag for each image in the given category.

Other tags used: images, thumbnail

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_dims" break=" x " />
  by <txp:image_info type="author" />
</txp:images>

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: images, thumbnail, if_different

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.