
192 ◾ PhoneGap Build
var cameraOptions = {
quality : 50,
sourceType : Camera.PictureSourceType.CAMERA,
destinationType : Camera.DestinationType.FILE_URI,
allowEdit : true,
encodingType: Camera.EncodingType.JPEG,
targetWidth: 100,
targetHeight: 200};
navigator.camera.getPicture(onSuccess, onFail, cameraOptions);
function onSuccess(data) {
capturedImage = document.getElementById("capturedImage");
capturedImage.src = data;
}
function onFail(err) {
alert('Command Cancelled or Error occurred while retrieving the image:
' + err);
}
Let us create an application to see how PhoneGap’s Camera API is used for invoking the
device’s default camera applicat ...