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) has a thumbnail assigned to it. Must always be used in an image context.
Only show a thumbnail if one exists
<txp:images author="neo" wraptag="div" class="author_gallery"> <txp:if_thumbnail> <div><txp:thumbnail /></div> <txp:else /> <div>No thumbnail</div> </txp:if_thumbnail> <txp:image_info /> </txp:images>
What this does…
For each image uploaded by neo, display its thumbnail if it has one, or the text “No thumbnail” if it doesn’t. Add the caption beneath that using image_info.