-
Notifications
You must be signed in to change notification settings - Fork 2
/
mine_image.html
43 lines (39 loc) · 1.24 KB
/
mine_image.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
34
35
36
37
38
39
40
41
42
43
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<link href="css/mui.min.css" rel="stylesheet" />
</head>
<body>
<img src="" width="100%" id="myimg"/>
<button type="button" class="mui-btn mui-btn-blue mui-btn-block" id="pick">从相册选取</button>
<button type="button" class="mui-btn mui-btn-blue mui-btn-block" id="capture">拍一张</button>
<script src="js/mui.min.js"></script>
<script type="text/javascript">
mui.init()
</script>
</body>
<script>
var pick = document.getElementById("pick");
var capture = document.getElementById("capture");
var myimg = document.getElementById("myimg");
mui.plusReady(function(){
var currentWindow = plus.webview.currentWebview();
myimg.src = currentWindow.imgSrc;
})
pick.addEventListener("tap",function(){
plus.gallery.pick(function(filepath){
myimg.src = filepath;
})
})
capture.addEventListener("tap",function(){
var cm = plus.camera.getCamera();
cm.captureImage(function(filepath){
var localpath = plus.io.convertLocalFileSystemURL(filepath);
myimg.src = localpath;
})
})
</script>
</html>