Reputation: 354
i am integrating camera in my phonegap application to record a video and to capture an image. i am using Phonegap 1.5.0 for iPhone.
to capture an imge i am using this code:
function capturePhoto() {
navigator.camera.getPicture(onPhotoDataSuccess, fail, { quality: 30 });
}
On button click i am calling above function but it did nothing. can anybody help me in this?
Thanks.
Upvotes: 2
Views: 2155
Reputation: 2983
I have tried it with Cordova latest and it's working fine. Please check the code -
<script type="text/javascript">
document.addEventListener("deviceready",onDeviceReady,false);
function onDeviceReady() {
console.log("CORDOVA IS WORKING:::");
}
function capturePhoto()
{
navigator.camera.getPicture(onSuccess, onFail, { quality: 50,
destinationType: Camera.DestinationType.FILE_URI });
}
function onSuccess(imageURI) {
var image = document.getElementById('myImage');
image.src = imageURI;
}
function onFail(message) {
alert('Failed because: ' + message);
}
</script>
Upvotes: 2