11. Camera

The PhoneGap Camera API provides an application with the ability to work with images, either captured directly from the camera or retrieved from the device’s photo repository. When retrieving an image, the API can return either a URI pointing to the image file on the device’s file system or the base64-encoded string representing the content from the image.

The API provides a single method, navigator.camera.getPicture, which is used to retrieve an image, and a cameraOptions object that’s used to define parameters around how the image is obtained, how it’s formatted, and more.

Applications can also use the PhoneGap Capture API to capture images using the camera. Refer to Chapter 12 for more information about this API. The Camera and ...

Get PhoneGap Essentials: Building Cross-Platform Mobile Apps now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.