Created
November 2, 2014 18:47
-
-
Save nielsdoorn/bf1e5c18652b18d12ac5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body, html { | |
height: 100%; | |
} | |
body { | |
background: linear-gradient(45deg, #f06, yellow); | |
} | |
h1 { | |
text-align: center; | |
} | |
img { | |
width: 100%; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<meta name="format-detection" content="telephone=no" /> | |
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" /> | |
<link rel="stylesheet" type="text/css" href="css/index.css" /> | |
<title>Foto maken</title> | |
</head> | |
<body> | |
<div id="app"> | |
<h1>Foto!</h1> | |
<button id="maak-foto">Maken</button> | |
<img id="myImage"> | |
</div> | |
<script type="text/javascript" src="cordova.js"></script> | |
<script type="text/javascript" src="js/index.js"></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.addEventListener('deviceready', init, false); | |
// Het apparaat is klaar | |
function init() { | |
document.querySelector("#maak-foto").onclick = function() { | |
navigator.camera.getPicture(fotoGemaakt, onFail, { | |
quality: 50, | |
//sourceType:Camera.PictureSourceType.SAVEDPHOTOALBUM, | |
destinationType: Camera.DestinationType.DATA_URL | |
}); | |
} | |
} | |
function fotoGemaakt(imageData) { | |
var image = document.querySelector('#myImage'); | |
image.src = "data:image/jpeg;base64," + imageData; | |
} | |
function onFail(message) { | |
alert('Failed because: ' + message); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment