-
cordova plugin add org.apache.cordova.camera
-
simple HTML
<img style="display:none;width:400px;height:400px;" id="bildcken" src="" />
<button onclick="takePhoto();">TAKE IT</button>
And the required JS:
function takePhoto() {
navigator.camera.getPicture(
function(imageData) {
var bild = document.getElementById('bildcken');
bild.style.display = 'block';
bild.src = "data:image/jpeg;base64," + imageData;
},
function() {
alert("YU NO WORK???")
}, { quality: 50, destinationType: Camera.DestinationType.DATA_URL,
sourceType: 1, // 0:Photo Library, 1=Camera, 2=Saved Album
encodingType: 0});
}