ez.no / exponential / documentation / reference / template operators / images / imagefile
imagefile( filename )
| Name | Type | Description | Required |
|---|---|---|---|
| filename | string | Name of image file to load. | Yes. |
Image layer.
This operator simply loads an image from the filesystem and returns it as an image layer. The layer can be used as a parameter to the "image" operator, which basically takes care of merging images.
For each image layer, the following information can be retrieved:
Attribute Type ------------------------- filepath string filename string width integer height integer alternative_text string imagepath string has_size boolean
If the "has_size" parameter is set to false then the width and height parameters will contain "false" instead of zero-valued integers.
If the operator is called directly (see example 1), the specified image will be displayed using a template that is associated with the image layer. This is the "/design/standard/image/layer.tpl" template. It is possible to override this template using the template override system.
The imagefile operator does not make use of an input parameter.
Example 1
{imagefile( '/design/my_design/images/test.jpg' )}
This will load "test.jpg" from the specified directory. Note: instead of hardcoding the path (like in the example above), the ezimage operator should be used instead. Since the operator is called directly, the template system will insert the layer template in order to display the image directly.
Example 2
{let test=imagefile( '/design/my_design/images/test.jpg' )} {$test|attribute( show )} {/let}
returns the following:
Attribute Type Value -------------------------------- filepath string '/design/my_company/images' filename string 'test.jpg' width boolean false height boolean false alternative_text string 'test' imagepath string '/design/my_company/images/test.jpg' has_size boolean false
Comments