Go to main content

If thumbnail

Contents

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 of its own. It accepts only the global attributes .

Examples

Example 1: Only show a thumbnail if one exists

<txp:images author="donald" 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 ‘donald’, 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.

If you notice any kind of problem with this page’s construction or content (outdated information, typos, broken links, or whatever), open an issue to have it sorted. Or have a go at it yourself. :)