If thumbnail

On this page:

Syntax

<txp:if_thumbnail>

The if_thumbnail tag is a conditional tag and always used as an opening and closing pair, like this…

<txp:if_thumbnail>
    ...conditional statement...
</txp:if_thumbnail>

The tag will execute the contained statements if the current image (from an images tag) has a thumbnail assigned to it. Must always be used in an image context.

Attributes

This tag has no attributes.

Examples

Example 1: Only show a thumbnail if one exists

<txp:images author="neo" wraptag="figure" class="author-gallery">
    <txp:if_thumbnail>
        <txp:thumbnail />
        <txp:image_info wraptag="figcaption" />
    <txp:else />
        <p>No thumbnail</p>
    </txp:if_thumbnail>
</txp:images>

For each image uploaded by author ‘neo’, display its thumbnail if it has one, or the text ‘No thumbnail’ if it doesn’t. Add a caption beneath the thumbnail using image_info.

Other tags used: images, else, image_info, thumbnail.

Genealogy

Version 4.3.0

Tag support added.

See something wrong in this document? Outdated info, a broken link, faulty code example, or whatever? Please write an issue and we’ll fix it.