WebCamera Block
2 different blocks exist for Web (Web Camera) and for Native (Camera Block).
Capture Photo
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.
Install the WebCamera Block Demo App
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.
IMPORTANT: DISPLAY PHOTO
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:
data:image/jpeg;base64,[[var:face
Where [[var:
Install the WebCamera Block Demo App
Show Photo
Use an image block with the variable defined under 'Image Variable Path' above to access the file.
WHY?
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.
Events
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.
Install the WebCamera Block Demo App
Save 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).