Implementing a Picture
A Picture-type question allows you to display an image in-line with the rest of your model content. The image must either be remotely stored with a URL that is accessible by your model, or have been converted into a base64 binary string.
One method of converting an image into a binary string is to upload it using a File Uploader, then using the GetUploadedDocumentBinaryString function.
Implementation:
- Switch to the Definition tab.
- Select the intended question group.
- Add a new question, and set the type to Picture.
- Right-click the selected question.
- Select Attributes.
- Add a new attribute.
You will need to specify which image you want to display by assigning one of the following attributes:
- Mapped to Variable - The variable specified by the attribute must have either a valid URL or a complete base64 binary string as its value.
- Mapped to Expression - The attribute's expression must return either a valid URL or a complete base64 binary string. This can be driven dynamically if you want to display a different image depending on one or more conditions.
Due to the maximum size limitation placed on expressions in the Expression Editor, you should not write a literal base64 binary string into the Attribute Expression field, as this will fail to parse and the picture will fail to display as a result.
- Switch to the Value panel.
- Depending which type you choose, enter a value into the Attribute Value or Attribute Expression field for the attribute.
- Click OK.
If you choose the Mapped To Variable attribute, the model variable must have a correctly formatted URL of your image as its value. An example of a valid URL is as follows:
http://www.mercatosolutions.co.uk/MercatoCompany/media/Layout/mercato-logo.gif
When you add the Mapped To Variable attribute to your question enter the keyword of your model's variable in the attribute's Initial Value field. When you preview your question, the image at the specified URL will be displayed at the position of the question within your model.