TT2Site Builder

Template::TT2Site

A Template::Toolkit extension
Template::Toolkit
User guide » 'util' files » image


INCLUDE util/image image = im_object
INCLUDE util/image image = filename
INCLUDE util/image image = { src => filename, ... }


There seems to be a bug that prevents the latter two forms from being handled correctly under all circumstances.

This instruction produces a graphic image.

TT2Site makes a distinction between two types of images, depending on whether an image is used on a particular page, or used on several (mostly, all) pages.

Images that are used on several pages should predefined in the file config/images. This file defines a global structure site.images that contains the relevant information for each image. This makes it easy and efficient to use them, e.g.

INCLUDE util/image image = site.image.logo

For an image that is used on a single page only, use the second form to specify the name of the image. For example, this will produce the image from file im01.jpg:

INCLUDE util/image image = "im01.jpg"

util/image will automatically provide default values for the image attributes, and calculate the dimensions. See config/images for a description of the image attributes.

For more complex situations, the third form can be used. This form allows any (or all) the relevant image attributes, and will fill in any missing values. For example:

INCLUDE util/image image = { src => "im01.jpg", title => "An Image", border => 1 }



Powered by Template Toolkit

© Copyright 2004-2006 Squirrel Consultancy. All Rights Reserved.
Site design: Squirrel Consultancy using TT2Site.
userguide/util/image.html last modified 14:57:49 05-Dec-2006