Including Images

Prev Next

You can put two kinds of images in an Exact Forms Plus document:

  • Images that are the same in every document, such as your logo. Insert them in the Word template with Insert > Pictures. They stay in every document as they are.

  • Images that change from record to record, such as a product photo or a signature. Store them in Quickbase or on the web, and put a token in the template where the image should go. This page explains how.

For a short list of all template tokens, see Template fields and functions.

Insert an image from a field

In the main part of the template (outside embedded reports), type an image token where the image should go:

~i:field ID:size~

For example, ~i:23:100~ inserts the image in field 23, 100 points wide. Image tokens take a field ID, not a field name. The field must be in the template's clist.

Token

Size in the document

~i:23:100~

100 points wide (72 points = 1 inch). The height keeps the image's proportions. Up to 3 digits.

~i:23:999~

The image's original size.

~i:23:100x50~

Exactly 100 wide and 50 high. The image can look stretched if the proportions differ.

~i:23:25%~

The original size made 25% smaller (75% of the original).

~i:23:25%F~

25% of the original size. Percentages can't make an image bigger. Anything over 99% is treated as 99%.

~23~

On an image field, the image 300 points wide.

  • The image takes the alignment of the paragraph the token is in. To center an image, center the token's paragraph in Word.

  • You can use the same image more than once, at different sizes.

  • Try a few sizes in test documents until the image fits.

Where the image can come from

Where the image is

What to do

A file attachment field on the record

Use the field's ID in the token, for example ~i:23:100~.

A file attachment field in another table or app

Create a formula rich text field on the master table that points to the file, and use that field's ID in the token. See Images from another table.

A web address

Put the address in a text or formula text field. It must end in an image file type, such as .png or .jpg, or be inside an HTML <img src="…"> tag. The address must open without signing in.

Pasted into a rich text field

Images pasted into a rich text field are stored inside the field's HTML. Use the plain field token, for example ~99~, not an image token. The image appears with the rest of the field's text.

Supported image types: .jpg, .jpeg, .png, .gif, .bmp, .tif, .tiff, .wmf. Photos taken on phones are turned the right way up automatically.

A formula URL field that links to an image on another website isn't treated as an image. Use a formula text field instead.

Images from another table

  1. On the master table, create a formula rich text field that builds an <img> tag for the file. For example, for the file attachment field 51 in another table, on the related record:

    "<div><img src=\"" & URLRoot() & "up/" & [_DBID_OTHER_TABLE] & "/a/r" & [Related Record ID#] & "/e51/v0\"></div>"
  2. Put the new field's ID in the template's clist, and use it in an image token, for example ~i:143:100~.

  • Use only src in the <img> tag, and put it first. Other attributes, such as width or height, stop the image from showing.

  • Put only the image in the field. If the field has text as well as an image, the text is dropped.

  • The user token saved for your account must be able to see the other table, or the image can't be downloaded.

When some records have no image

If the field is empty, the token stays in the document as typed, for example ~i:23:100~. To show nothing instead:

  1. Create a formula text field, for example field 24:

    If([Photo] > "", "~i:23:100~", "")

    To show text instead of the image, put the text in place of the last "", for example [Client Name].

  2. In the template, use ~24~ instead of the image token.

  3. In the template's clist, put field 24 before field 23, for example 3.4.5.24.23.25. Exact Forms Plus fills in fields in clist order, so field 24 has to put the image token in the document before field 23 replaces it.

To make the image a link, wrap the <img> tag in an <a href> tag in a formula rich text field. For example, for file attachment field 51 on the same record:

If([File] > "", "<div><a href=\"https://www.example.com\"><img src=\"" & URLRoot() & "up/" & Dbid() & "/a/r" & [Record ID#] & "/e51/v0\"></a></div>", "")

Use this field's ID in an image token. The link must be the whole value: start with <a href or <div><a href and end with </a> or </a></div>.

Images in embedded reports

Image tokens don't work inside embedded reports (subtables). Instead, set the column's type to Image in the EFP Configurator. In the embedded report's settings, the column looks like CI142:50: C for centered, I for image, field 142, and a column width of 50.

  • The image is sized to the column: its width is 65% of the column width. Set a column width. Without one, the image is very small.

  • The image can come from the same places as in the main part of the template: a file attachment field on the related record, another table, or a web address.

  • If the column's field has a file that isn't an image, the cell is left blank.

  • For a rich text field with a pasted image, set the column type to Rich Text, not Image.

Text above or below an image

To add a caption in the same cell, use a formula rich text field on the related table. Put text above the image in <h3> and text below it in <h4>. Use either one or both:

"<div><h3><b>Front view</b></h3><h4>Photo taken on site</h4><img src=\"" & URLRoot() & "up/" & Dbid() & "/a/r" & [Record ID#] & "/e21/v0\"></div>"

In the EFP Configurator, set this column's type to Image, not Rich Text. The caption uses the column's alignment.

If an image doesn't appear

What you see

What to check

The token, such as ~i:23:100~, is left in the document.

The field is empty for this record, the field ID isn't in the clist, or you used a field name instead of an ID. See When some records have no image.

ERROR: followed by the image address

The image couldn't be downloaded. Open the address in a private browser window: it must open without signing in. For files in Quickbase, check that the user token saved for your account can see the table.

ERROR-Invalid format: followed by the value

The src value doesn't start with http. Use the full address.

The image is missing, but text from the same field is there, or the other way round

Put the image in a field of its own. If an <img> tag has attributes other than src, remove them.

The image is tiny in an embedded report

Set a column width for the image column in the EFP Configurator.

For other errors, see Troubleshooting.