Image sources

From PhiWiki
Jump to: navigation, search
Imagesources.png

You can choose between different image sources for any image based element in Phi.

If you check Do NOT cache item the image is always created newly for every client request from the selected source. This may be very time consuming.

Static and Translated images are stored directly within the *.phis file. You do not need to upload them separately to the server into an image directory.

Static

This is the default option and also the fastest one. The image will be displayed as choosen.

Translated

The image depends on the currently choosen language of the browser.

If the image of a translation for a requested language is invalid the 'C' image is used.

See also: Defining available languages for your page, document.languages, phi.lang.

Database

Use $PHISQL[x] (with 'x' as the position) to reference the values of the result set of the given SELECT statement in the Template field. Mark Source represents a file name if the query returns a filename instead of image data (i.e. a BLOB type).

Mark Do NOT cache data if the filenames of the result set are changing.

See also: Database support, Sql class.

File

You can load the image directly from a file (relatively to the document root). If you specify a 'C' in the file path the 'C' will be replaced by the current used language.

Mark Do NOT cache data if the filenames are changing.

See also: File translations.

Url

An image can also be loaded from an external URL. This could be time consuming if you are not caching the image (see above notice about caching).

Mark Do NOT cache data if the source of the URL is changing.

If a HTTP response header with Content-Type and charset= is provided the text is encoded with this charset. Otherwise UTF-8 is assumed.

Warning: Do NOT use URLs on the same localhost or this could lead in infinite recursion.

Process

You can use an image read from the output of a system process. Simply specifiy the path to the external program. The attributes list may contain Phi variables which are substituted before the process is started.

Mark Do NOT cache data if the returned image filename is changing (if the output is a filename and not an image).

See also: system.exec().