Capturing an image from a mobile device's camera
In this recipe, you will learn how to take a picture using the mobile device's camera.
How to do it...
Use the following code to prompt the user to select an image from their device's image library:
on mouseUp mobilePickPhoto "camera" if the result is empty then // do something end if end mouseUp
How it works...
For both iOS and Android devices, we can use the mobilePickPhoto
command to prompt the user to snap a photo using the device's camera. We accomplish this by passing camera
as the parameter.
There's more...
For iOS devices only (not Android), we can use rear camera
or front camera
as the parameter to specify which camera is to be used. Also, as you might assume, we cannot test a mobile device's camera in the simulator.
See also
The Loading an image recipe
The Resizing an image recipe