journey.photos
Photo quality
When using multiple photo capture, photos are stored at 85% quality by default. If you wish to take and display more than 5 photos at a time, please set the quality down to below 25%, which corresponds approximately with the default quality for capture-photo.
This feature allows an app user to take multiple photos in quick succession from the app.
Taking multiple photos in a single workflow works slightly different from the capture-photo UI component. The biggest difference is that there isn't an XML component and that there isn't a variable or field that the resulting photos are automatically bound to.
Instead, the developer calls a function that can be triggered from anywhere, e.g. a button or object-table, and the function returns an array of image attachments that the developer can use however they prefer.
Syntax
journey.photos.capture(options), where options are optional:
max
Optional maximum number of photos to be taken. Defaults to undefined that means no limit. If the max number is reached, the camera dialog is automatically closed and the function returns.
quality
Optional number between 1 and 100 to set the quality of the resulting images. Defaults to 85. The equivalent of medium resolution photos for capture-photo is around 25, and is recommended for most use cases.
The resulting array of attachments can be used by the developer however they prefer. If the user cancels the camera without taking any photos, the function will return an empty array.
Note: Multiple photos is currently only supported on mobile devices, and support for this feature can be evaluated for a device as follows:
journey.photos.getCapabilities(). This will return an object:
{
"supported": true | false
}Example
In this basic example, we have a button that allows a user to take 10 photos in a single flow. The photos are then added to an array that is displayed in a List component that triggers a Dialog that has a display-photo component and some buttons to delete the photo.
The user will also be able to add more photos by clicking the button again, and new photos will be added to the top of the list in this example.
Firstly, we create a new model in the app's Data Model to store the photos:
In our view XML, we have this:
In the corresponding JavaScript/TypeScript for the view:
Last updated