The default output that the image_preset produces when output directly to the template, which is currently the preset code. The default output may change at any time. Template developers should avoid using this and should handle the output of image presets themselves
ExampleLoad one image preset and read its code and query_string{% image_preset %} loads a single preset by code or GUID; code and query_string describe how the preset transforms images.
Liquid
{%- image_preset var thumb = "thumb" -%}
{%- if thumb.is_valid -%}
<p>Preset {{ thumb.code }} → {{ thumb.query_string }} ({{ thumb.extension }})</p>
{%- endif -%}
{% image_preset %}
Identifies the image preset by its code rather than a name. Codes are matched without regard to case.
{% image_preset output_to_template? [[var, set, or assign]? variable_name]? output_to_template? = value %}Parameters
output_to_templateoptionalflag
Include this flag to write the image_preset's output into the page at this point. What that output is differs by type, and for most types it is a built-in default that may change at any time, so see the output property of the image_preset object before relying on it. The flag may come before or after the variable name. When the call names no variable, the output is written whether or not the flag is present, which makes {% image_preset = value %} the smallest valid use of this method. When the call names a variable, the flag saves the image_preset to the variable and writes its output as well.
var, set, or assignoptionalkeyword
Chooses the scope that holds the variable. var, the default, stores it in the current scope. set and assign can store it in outer scopes; Variable Scopes compares the three and when each fits.
variable_nameoptionalvariable
The variable that receives the image_preset. It may also be written as a reference, &name, which reads the variable's name from another variable (see Methods Overview). Leave it out to write the image_preset to the template instead.
valuerequiredexpression
Required; without a value the method call is not valid. Identifies which image_preset to fetch. It can evaluate to the image_preset itself, to its GUID, or to other text that identifies it, which for most types is its name; a type identified some other way, or only by GUID, says so in its summary. Names are matched without regard to case, but accented letters must match. A GUID identifies exactly one record, whereas when several records share a name, which of them is returned is not specified, so giving the records you fetch by name unique names avoids the question. A name reads better in a template and a GUID is exact; neither suits every site. When nothing matches, no error is raised: the variable holds an invalid image_preset, whose is_valid is false, so check is_valid before using it. When the expression itself has no value, for example an undefined variable, the method does nothing and the variable keeps any earlier value. May use liquid filters.
ExampleLoad one image preset and read its code and query_string{% image_preset %} loads a single preset by code or GUID; code and query_string describe how the preset transforms images.
Liquid
{%- image_preset var thumb = "thumb" -%}
{%- if thumb.is_valid -%}
<p>Preset {{ thumb.code }} → {{ thumb.query_string }} ({{ thumb.extension }})</p>
{%- endif -%}