ezimage
Summary
Returns the input string prepended with the current image directory.Usage
input|ezimage( [ quote [, slash_skip ] ] )
Parameters
Name | Type | Description | Required |
---|---|---|---|
quote | string | Quote style: "no", "single" or "double" (default). | No. |
skip_slash | boolean | Include (FALSE, default) or skip (TRUE) the first slash. | No. |
Returns
The input string prepended with the current image directory.Description
This operator prepends the input string with the location of the image directory used by the current design. If the operator is unable to find the specified file within the "images" subdirectory of the current design, it will attempt to locate it in the "images" subdirectory of the fallback designs or the standard design. The "ezimage" operator should always be used when an image is included in a template. It will make sure that the path to the image is always correct, regardless of the location of the eZ Publish directory, the access method, the environment, and so on.
By default, this operator returns a double-quoted string. The optional "quote" parameter can be used to control the way the address is returned: "no" (no quotes), "single" (single quotes) or "double" (double quotes, the default). The optional "skip_slash" parameter can be used to get rid of the first slash within the string that is being returned (when set to false()).
Examples
Example 1
In this example, the design "my_company" is used by the siteaccess. Images should be included in the following way:
<img src={'banner.jpg'|ezimage()} alt="My banner" ...>
The following output will be produced:
<img src="/design/my_company/images/banner.jpg" alt="My company" ... />
If eZ Publish 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/banner.jpg" alt="My company" ...>
Balazs Halasy (05/02/2004 11:48 am)
Svitlana Shatokhina (24/01/2007 9:32 am)
Comments
There are no comments.