Image_preset

Image_preset

{{ image_preset }}

Properties of {{ image_preset }} objects
Name Type Description
object_type String Will always be datastore_item
is_valid Boolean True if this references a published image_preset
guid String The unique identifier for this image_preset
value String Contains the same value as guid
code String The unique code for this image preset
query_string String The settings for this image preset represented as a query string
extension String The extension that filenames should end with for images that use this image preset, if it may be used to change the image format
settings dictionary Contains all of the settings that this image preset will apply to images when used
field_id String The identifier for this field
label String The label for this field
output String 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

Related

{% image_preset %}

{{ form }}

{{ dictionary }}

Object containing a list of key-value pairs where the keys are unique.

{% images %}

{{ code }}

{% image %}

{% image_url %}

Resolves the URL for an image with the desired presets and other settings applied.

string

Can be any text, from the empty string ("") to the full HTML output of the template. When used alone in a conditional, all strings evaluates as true - even if they are empty or a value such as "0" or "false".

{{ images }}

Contains multiple images.

{{ image }}

{% image_preset %}

{% image_preset output_to_template? [[var, set, or assign]? variable]? output_to_template? = value %}

{% image_preset
output_to_template
 
If included the image_preset will be output directly to the template.
var, set, or assign
 
Optional. Specify either "var", "set" or "assign" to change which scope this image_preset is stored on. "var" is the default behavior.
variable_name
 
Specify a variable name in order to save this image_preset to a variable. If not specified, it will be output to the template instead.
output_to_template
 
If included the image_preset will be output directly to the template.
=
 
Should evaluate to a image_preset object, or the name or guid of a image_preset May use liquid filters.
%}

Fetches a single image_preset.

Related

{% images %}

{% image %}

{% image_url %}

Resolves the URL for an image with the desired presets and other settings applied.

{{ image_preset }}

{{ images }}

Contains multiple images.

{{ image }}

Examples

Demonstrates how to image_url with presets.

Image_url with presets

Copy
Template: {% image_url img_path = page.banner_image name:"home-banner" preset:"banner-size" preset:"sepia-simple" %}
<a href="{{img_path}}"><img src="{{img_path}}" class="thumb" /></a>
Output: <a href="https://domain.com/path/to/altered/img.jpg"><img src="https://domain.com/path/to/altered/img.jpg" class="thumb" /></a>

Demonstrates how to image_url altered.

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: "https://domain.com/path/to/altered/img.jpg"