image info
From Textbook
(Difference between revisions)
(New page: {{Mininav tags}} <code class="bamtag"><txp:image_info /></code> The image_info tag is a ''single'' tag that Textpattern will replace with the relevant image data from the current im...) |
|||
| Line 30: | Line 30: | ||
:: <code>thumb_h</code> (image thumbnail height) | :: <code>thumb_h</code> (image thumbnail height) | ||
:: <code>date</code> (timestamp of image upload: this is not very useful so consult [[image_date]] for a better alternative) | :: <code>date</code> (timestamp of image upload: this is not very useful so consult [[image_date]] for a better alternative) | ||
| + | : Default: <code>caption</code>. | ||
; [[Attributes Cross-reference#wraptag|wraptag]]="tag text" | ; [[Attributes Cross-reference#wraptag|wraptag]]="tag text" | ||
: (X)HTML tag to wrap the items grabbed from the '''type''' attribute, specified without brackets. | : (X)HTML tag to wrap the items grabbed from the '''type''' attribute, specified without brackets. | ||
| Line 45: | Line 46: | ||
: Escape HTML entities such as <code><</code>, <code>></code> and <code>&</code> for the given '''type'''s. | : Escape HTML entities such as <code><</code>, <code>></code> and <code>&</code> for the given '''type'''s. | ||
: Values: <code>html</code> or unset. | : Values: <code>html</code> or unset. | ||
| + | : Default: <code>html</code> | ||
== Examples == | == Examples == | ||
| Line 58: | Line 60: | ||
; What it does... | ; What it does... | ||
| - | : Grabs all images from the '''mammals''' category and displays the image thumbnail itself along with the image caption surrounded with <code><div class="img_cap">...</div></code> tags. Note that the image IDs/names are not specified inside the container because they are automatically assigned from the <code><txp:image_list></code> tag for each image in the given category. | + | : Grabs all images from the '''mammals''' category and displays the image thumbnail itself along with the image caption surrounded with <code><nowiki><div class="img_cap">...</div></nowiki></code> tags. Note that the image IDs/names are not specified inside the container because they are automatically assigned from the <code><txp:image_list></code> tag for each image in the given category. |
Other tags used: [[image_list]], [[thumbnail]] | Other tags used: [[image_list]], [[thumbnail]] | ||
| Line 82: | Line 84: | ||
=== Example 3: Specific image information === | === Example 3: Specific image information === | ||
| - | <code><txp:image_info id="5" type=" | + | <code><txp:image_info id="5" type="category_title" /></code> |
; What it does | ; What it does | ||
| - | : Displays the | + | : Displays the category_title of the category assigned to image ID 5. |
== Genealogy == | == Genealogy == | ||
Revision as of 22:17, 9 March 2010
<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 -
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




