ezimage

Summary

Prefixes input string with image directory in current design.

Usage

$input_string|ezimage( [ quote [, slash_skip ] ] )

Parameters

NameTypeDescriptionRequired
quote string Type of quote: single, double, no. Default is double. no
slash_skip boolean Skip prepending slash. no

Returns

input string prepended with correct image path.

Description

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.

Examples

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

Contents

Reference

Database diagram
Template operators
    PDF
    Arrays
    Data extraction
    Formatting
    Images
    Logic
    Mathematics
    Miscellaneous
    Strings
    URLs
       ezdesign
       ezimage
       ezroot
       ezurl
       exturl
    Variables
Template functions
Data fetching
Modules
XML tags


Created

05/02/2004
12:48:50 pm
by Balazs Halasy

Last updated

18/02/2004
8:42:50 am
by Kåre Køhler Høvik

Authors

Balazs Halasy
Kåre Køhler Høvik



This page is part of the Exponential documentation. The documentation is available under the GNU Free Documentation License. All contributions will be released under the terms of this license.