Altova MobileTogether Designer

Let User Choose Image

Home Prev Top Next

The end user can select an image that will be saved in Base64 format to a node of the page source tree (see screenshot below). This enables the end user to select images that are automatically saved to a database. An example of a usage scenario would be the reporting of damages for insurance purposes. The user could run the solution and take a photograph with the mobile device. The image would be directly uploaded to the appropriate database.

MTDLetUserChooseImage01

The action has the following properties:

 

Image source: Select Gallery to let the user choose an image from the image gallery of the client device. Select Camera to start the camera app of the mobile device and capture the next photo taken by the camera.

Target Node: A page source node in which to save the image as Base64-encoded data.

 

The Let User Choose Image action has three conditions:

 

On OK: Define actions to perform if the image is correctly imported to target node as Base64-encoded data. Typical actions to perform would be: (i) Reload the image control that displays the selected image; this updates the display with the selected image; (ii) Save Image to File if the image is required to be saved as a binary image file (as opposed to being saved in an XML node as Base64-encoded text); (iii) Load/Save to File saves the XML data, including the newly added Base64-encoded image data to the page source.

On Cancel: If the image selection process is canceled by the user, some actions might be needed to rollback modifications made preparatory to importing the user-selected image.

On Error: Define actions to take in case the image is not imported correctly into the target node. For example, the user can be informed that the selection has failed, and/or a Troubleshooting page can be opened in a web browser.

 

For an example of how to use this action, see the section Images Chosen by End User.

 

MobileTogether extension functions

MobileTogether provides a range of XPath extension functions that have been specifically created for use in MobileTogether designs. Some functions can be particularly useful with specific actions. For example, mt-available-languages() returns the languages in which the solution is available and could, for example, be used with the Message Box action. If a function is especially relevant to this action, it is listed below. For a full list of extension functions and their descriptions, see the topic MobileTogether Extension Functions.

 

mt-base64-to-hexBinary()

mt-hexBinary-to-base64()

mt-hexBinary-to-string()

mt-change-image-colors()

mt-extract-file-extension()

mt-extract-file-name()

mt-image-width-and-height()

mt-string-to-hexBinary()

mt-transform-image()

 

© 2018-2024 Altova GmbH