Web Oriented Object Framework

User Guide (Version 0.5b4)

Woof!
User Guide (Version 0.5b4)

Using images

Generating the URL for an image

You can generate the URL for an image with the url_for_image controller method. This will return a URL pointing to an image file. For example,

[my url_for_image logo.png]

will generate

http://woof.sourceforge.net/woof-ug-0.5/images/_woof/logo.png

The above example converts a image file name to a URL. The file is located as described in the Locating static resources chapter with public/images as the search root.

Alternatively, you can also pass in relative or absolute URLs (though the latter is only useful in the context of include_image described below). For example, a relative URL can be passed in as

[my url_for_image images/_woof/logo.png]

which will generate

http://woof.sourceforge.net/woof-ug-0.5/images/_woof/logo.png

Note that the relative URL is always assumed to be relative to the URL root for the Woof! application.

Generating a link for an image

Alternatively, you can generate the entire link for an image with the include_image controller method. Any additional attributes can also be passed to the command. For example,
[my include_image http://example.com/absolute/url/image.png alt "Absolute URL image"]

will generate

<img src='http://example.com/absolute/url/image.png' alt='Absolute URL image'>

The additional attributes to be added to the <img> tag can be passed to include_image as additional arguments or as a single dictionary argument. For example, the following two commands

[my include_image logo.png alt logo class imgclass]
[my include_image logo.png {alt logo class imgclass}]

will have the same effect:

<img src='http://woof.sourceforge.net/woof-ug-0.5/images/_woof/logo.png' alt='logo' class='imgclass'>
<img src='http://woof.sourceforge.net/woof-ug-0.5/images/_woof/logo.png' alt='logo' class='imgclass'>