ez.no / exponential / documentation / reference / template operators / urls / ezimage
$input_string|ezimage( [ quote [, slash_skip ] ] )
| Name | Type | Description | Required |
|---|---|---|---|
| quote | string | Type of quote: single, double, no. Default is double. | no |
| slash_skip | boolean | Skip prepending slash. | no |
input string prepended with correct image path.
This operator prepends the current image directory to the inputted string. The result is a valid file location. The operator will first check if the file specified in the input string exists in the images directory of the current design. If the image is found, the path to the images directory within the current design will be prepended. If the operator is unable to find the file within the images subdirectory of the current design directory, it will attempt to find the file within the images subdirectory of the additional designs. If the file is still not found, the string will be prepended with the path to the images subdirectory within the standard design.
By default, the returned string is encapsulated by double quotes. However, this can be changed by using the quote parameter. The quote parameter can be set to either "single", "double" or "no". The "single" option tells the operator to encapsulate the returned string in single quotes and "no" will simply tell the operator to drop quotes completely. The "double" option will instruct the operator to use double quotes (default behaviour).
The second parameter can be used to drop the first slash within the string that is being returned. This happens if the second parameter is set to "false". Please note that setting this parameter to "true" (or anything else) will still result in a slash skip.
In this example, the design "my_company" is used. This is how an image should be included in a template:
<img src={"banner.jpg"|ezimage} alt="My banner" ...>
The template code above will be translated into the following:
<img src="/design/my_company/images/home.jpg" alt="My company" ...>
If Exponential is unable to find the image within the images directory of the current design directory, it will attempt to find it within the images subdirectory of the additional designs. At last, it will fallback to the standard design. In this case, the output will be the following:
<img src="/design/standard/images/home.jpg" alt="My company" ...>
Comments