Dynamic images
Dynamic images are called dynamic because they are switched, depending on the value of a data field. This way, a template can be adjusted to different customers.
This page describes how to insert dynamic images using the Dynamic Image Script Wizard.
Otherwise, adding dynamic images requires a self-made script (see Writing your own scripts, template and ImageResource).
Adding dynamic images
Dynamic images can be added to the template using the Dynamic Image Script Wizard only if you have:
-
One or more data fields that contain values on the basis of which the images can be switched.
-
An appropriate image for each case. All files should be of the same type and they need to be stored in the same location (the Images folder on the Resources pane, a folder on disk, or online). It is important that they are named after the various possible values of the related data field.
To use the Dynamic Image Script Wizard:
-
Add one image to the template. See Adding images.
-
Right-click the image and click Dynamic Image. Or select the image and click Source (not the field, but the label before the field) in the Attributes pane.
The Dynamic Image Script Wizard opens. The image's ID is used as the script's selector. If the image did not have an ID, it is automatically generated. -
Select the location of the files:
-
Select Resources if the images reside in the Images folder on the Resources pane.
-
Folder on disk refers to a folder on a hard drive that is accessible from your computer. Click the Browse button to select a folder.
As an alternative it is possible to enter the path manually. You can give a local path (e.g. C:\Images\) or use the "file" protocol. The complete syntax of a fully qualified URL with the "file" protocol is:file://<host>/<path>
. Note: if the host is "localhost", it can be omitted, resulting infile:///<path>
, for example:file:///c:/resources/images/
. -
Online requires you to give a specific web address (for example, http://www.mysite.com/images/).
The Dynamic Image Script Wizard composes the file names (including the path) based on the selected location, the prefix, the value of a data field, and the suffix. The variable part of the file names is the value of the data field(s) in the Field column. The prefix and suffix are meant to contain static parts of the file names.
Click the first field in the column Field, and then click the downward pointing arrow. Select the data field to be evaluated.
If you want the file name to be composed of the value of several data fields, simply click in the next row or click the Add button. This adds a row. Note that the rows will be concatenated to compose one file name. Only the last suffix should contain the file extension.
-
-
The resulting file name, including the path and file extension, is assigned to the src (source) attribute of the image. You can click Options to verify this.
-
Click Apply or OK. Now click the Preview tab and browse through the records to verify that the script works as expected.
The dynamic images feature can be used to insert dynamic signatures.
How to insert dynamic images if there are no data fields with the actual names of the images is described in another how-to: Dynamic image that doesn't contain the data field value.
Note: An image with an unknown file extension is represented by a red cross in the output, but no error is logged unless the image refers to a local file that does not exist on disk.
Image file extensions that the software recognizes are: AFP, BMP, EPS, GIF, JPG/JPEG, PCL, PDF, PNG, PS, SVG, and TIF/TIFF.
Editing a Dynamic Image
To edit dynamic images added to the template earlier, right-click the image, or the space reserved for the dynamic images. Then click Dynamic Image to open the Dynamic Image Script Wizard again.
Alternatively you may double-click the respective script on the Scripts pane.