我一直试图找出为什么在单击图像时相机无法启动,这使得它成为一个按钮。即使尝试重新安装cordova相机插件,错误仍然存在。请帮助......
function onDeviceReady() { <<<------ JS File
$("#photo1").click(Camera1);
detection();
}
function Camera1() {
navigator.camera.getPicture(onSuccess, onFail, {
quality: 50,
destinationType: Camera.DestinationType.DATA_URL,
sourceType: Camera.PictureSourceType.CAMERA,
encodingType: Camera.EncodingType.JPEG,
targetWidth: 300,
targetHeight: 300,
popoverOptions: CameraPopoverOptions,
saveToPhotoAlbum: true
});
function onSuccess(imageData) {
var image = document.getElementById('myImage');
image.src = "data:image/jpeg;base64," + imageData;
}
function onFail(message) {
$("#errormsg").text("ERROR");
}
};
});
<body> <<<----- HTML File
<div data-role="page" id="page1">
<input type="image" id="photo1" src="images/download.png" width="200" height="90" />
<label for="photo2">Take a Photo</label>
<img id="myImage" src="" />
<div id="errormsg"></div>
<div id="displayresults"></div>
<input type="image" id="fall" src="images/piq96Mxi9-800x675.jpg" width="200" height="90" />
<label for="photo3">Fall Detection</label>
</div>
<div data-role="page" id="page2">
<p id="lastphoto"></p>
<button class="ui-btn">Send</button>
</div>
<script src="http://code.jquery.com/jquery-1.8.0.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="scripts/platformOverrides.js"></script>
<script type="text/javascript" src="scripts/index.js"></script>
</body>
</html>
答案 0 :(得分:0)
可能的解决方案是,