Go to main content

Image url



<txp:image_url />

The image_url tag is a single or a container tag that Textpattern will replace with the URL of the current image in an images list, or the specific image if given an id or name.

If used as a container, it must be specified as an opening and closing pair of tags, like this:

    …link contents…


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

An id assigned at upload of an image to display. The IDs can be found on the Images panel.
Default: unset.
link="link type"
Whether to hyperlink the URL or not.
1: hyperlink the URL (if used as a single tag) or the container content.
0: don’t hyperlink the URL/container.
auto: only apply the hyperlink if the tag is used as a container.
Default: auto.
name="image name"
An image to display, given by its image name as shown on the Images panel. If both name and id are specified, the id takes precedence.
Default: unset.
Display the link to the image’s thumbnail instead of the full size image.
Values: 0 (display the full size image) or 1 (display the thumbnail).
Default: 0.


Used as a single tag:

<txp:images category="mammals">
    <a href="<txp:image_url />">
        <txp:thumbnail />

Used as a container:

<txp:images category="mammals">
        <txp:thumbnail />

Other tags used: images, thumbnail.

Example 2: Usage outside of image list context (directly via image ID)

<img alt="<txp:image_info id="21" type="alt" />"
    src="<txp:image_url id="21" link="0" />"
    srcset="<txp:image_url id="22" link="0" /> 2x,
            <txp:image_url id="21" link="0" /> 1x">

Other tags used: image_info.


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. :)