{% 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"] [preset: "code1"] [preset: "code2"] [preset:"code3 code4"] %}

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 as shown in syntax above with code3 and code4.

Examples

Image_url

Copy
Template: {% image_url output_to_template = entity.image %} Output: "http://domain.com/path/to/img.jpg"

Image_url with presets

Copy
Template: {% image_url img_path = page.banner_image name:"home-banner" preset:"banner-size" preset:"sepia-simple" %} Output:

Image_url altered

Copy
Template: {% capture imageCode %}thumb-{{size}} border-{{bordercolor}}{% endcapture %} {% image_url img_path output_to_template = img extension:"png" preset:"transparent20" preset:"border10" imageCode %} Output: "http://domain.com/path/to/altered/img.jpg"