Textpattern logo

Help?

article image

From Textbook

<txp:article_image />

The article_image tag is a single tag. Textpattern will replace this tag with the <img src="..." /> HTML tag matching the numeric ID or URL assigned when the article is posted.

The image to be associated with the tag is set under the Write tab. Click "Advanced Options" and enter either the URL of the image, or the Textpattern ID (a number set by Textpattern at upload) into the Article image field. Most of the time you will use the image ID here. Note that you can only assign a single image to each article.

Contents

Attributes

Tag will accept the following attributes (case-sensitive):

thumbnail="boolean"
Use the thumbnail rather than full-size image.
Values: 1 (yes) or 0 (no).
Default: 0.
escape="html"
Escape HTML entities such as <, > and & for the image's alt and title attributes.
Value: html or unset.
Default: html.
wraptag="tag"
HTML tag to be used to wrap the img tag, specified without brackets.
Default: unset.
class="class name"
CSS class attribute to apply to the image (or to the wraptag, if set).
Default: unset.
html_id="id"
The HTML id attribute assigned to the image (or to the wraptag, if set).
Default: unset.
style="style rule"
Inline CSS style rule.
Default: unset.
aligndeprecated="HTML value"
HTML align attribute for the img tag. Recommended that you use CSS via class or html_id attribute instead.
Default: unset.

Examples

Example 1: Use wraptag and class for styling

<txp:article_image wraptag="p" class="article-image" />
What this does...
This will wrap the image in paragraph tags, applying the class to the paragraph: <p class="article-image"><img src="..." /></p>.
Why you might do it...
It gives you full control over the image's appearance using CSS.
Note
Without the wraptag, the class is applied directly to the img tag

Example 2: Link thumbnail to the article

Used in an article list form this will display an article list consisting of hyperlinked article images' thumbnails.

<txp:permlink><txp:article_image thumbnail="1" /></txp:permlink>

Other tags used: permlink

Genealogy

Version 4.2.0

  • attribute align deprecated

Version 4.0.7

  • default value for attribute escape changed from unset to html

Version 4.0.4

  • class, escape, html_id, thumbnail, and wraptag added.

Translations [?]...

About Textbook