{% image_url %}

Use this tag to get the URL for an image with the desired presets applied.

Syntax

Syntax: {% image_url [[var|set|assign] new_variable_name] [output_to_template] Image [name:"filename"] [extension:"ext"] ["code1" [code2 [etc...]]] %}

You MUST include at least either a variable name to assign the url to, "output_to_template", or both (if both, output_to_template should be the later argument).

If you are assigning the article to a variable and do not specify one of "var", "set", or "assign", then the "var" behavior will be used - which is to save the result on the current scope. If new_variable_name starts with '&', will attempt to assign the value by reference.

You may include as many image preset codes as desired. Additionally, you may include multiple codes in a single string by separating them with spaces.

Examples

Template: {% image_url output_to_template entity.image %}
Output: "http://domain.com/path/to/img.jpg"
Template: {% image_url img_path page.banner_image name:"home-banner" "banner-size" "sepia-simple" %}
<a href="{{img_path}}"><img src="{{img_path}}" class="thumb" /></a>
Output: <a href="http://domain.com/path/to/altered/img.jpg"><img src="http://domain.com/path/to/altered/img.jpg" class="thumb" /></a>
Template: {% capture imageCode %}thumb-{{size}} border-{{bordercolor}}{% endcapture %}
{% image_url img_path output_to_template img extension:"png" "transparent20" "border10" imageCode %}
Output: "http://domain.com/path/to/altered/img.jpg"

Developer Overview

Liquid Markup