2 different blocks exist for Web (Web Camera) and for Native (Camera Block).
The WebCamera Block allows you to display the camera input in a block and take a photo.
The camera works with the front facing camera
It is useful for Selfie
If you don't need a specific area and or preview you can also use the Take Photo Action which works with the back camera.
Take Photo is done by tapping on the Block itself.
Tap to Capture
With the WebCamera Block you simply Tap on the block to take a photo.
That photo is stored in a Base64 format in a variable of your choice.
To display a photo using the Image Block on iOS, because we store a path to the B64 format you MUST use the following syntax:
Use an image block with the variable defined under 'Image Variable Path' above to access the file.
The web camera block generates raw base64 data, which can’t be rendered as-is. Instead, you have to build a url using the data: protocol so the image block knows how to interpret it.
Note that while the image block needs the extra prefix to display the base64 image, the server will have issues if you send the data url instead of the raw base64 data, which is why we can’t just include the prefix when we store the image.
1 Events is available: Tap Event
In these example from the WebCamera demo app we use a layer to display the photo.
Then we refresh the photo.
Once you have captured an image you can:
- Save that photo on your device
- Save that photo in a REST service (like Cloud Collection).