<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Camera Example</title>
<script type="text/javascript">
// 拍照
function captureImage() {
var cmr = plus.camera.getCamera();
var res = cmr.supportedImageResolutions[0];
var fmt = cmr.supportedImageFormats[0]; //设置照片的参数
cmr.captureImage(function(path) { //path为照片的路劲
plus.gallery.save(path, function successCB(){ //存储照片的方法
alert("存储成功")
});
},
function(error) {
alert("Capture image failed: " + error.message);
}, {
resolution: res,
format: fmt
}
);
}
</script>
</head>
<body>
<button class="btn" οnclick="captureImage()">拍照</button>
</body>
<style>
.btn {
width: 375px;
height: 50px;
background-color: burlywood;
color: #fff;
}
</style>
</html
html5plus拍照功能
最新推荐文章于 2022-05-16 09:14:42 发布