forked from burga05/webcodecamjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimple_localimage.html
33 lines (33 loc) · 1.23 KB
/
simple_localimage.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Demo</title>
</head>
<body>
<h3>Simple initalization with default settings</h3>
<h3>And decode uploaded image.</h3>
<hr>
<canvas with="320" height="240"></canvas>
<hr>
<input type="button" id="upload" value="upload" onclick="decodeLocalImage();">
<ul></ul>
<script type="text/javascript" src="js/filereader.js"></script>
<script type="text/javascript" src="js/qrcodelib.js"></script>
<script type="text/javascript" src="js/webcodecamjs.js"></script>
<script type="text/javascript">
var txt = "innerText" in HTMLElement.prototype ? "innerText" : "textContent";
var arg = {
resultFunction: function(result) {
var aChild = document.createElement('li');
aChild[txt] = result.format + ': ' + result.code;
document.querySelector('body').appendChild(aChild);
}
};
var decoder = new WebCodeCamJS("canvas").init(arg);
function decodeLocalImage(){
decoder.decodeLocalImage();
}
</script>
</body>
</html>