[英]How to select image from photo library and show the system camera interface within the app?
[英]Phonegap 1.3 captureImage to Photo Library and display image in HTML/App interface
我一直在使用以下代碼來抓取照片並以html顯示,效果很好。
function takePicture() {
navigator.camera.getPicture(
function(uri) {
var img = document.getElementById('camera_image1');
img.style.visibility = "visible";
img.style.display = "block";
img.src = uri;
document.getElementById('camera_status').innerHTML = "Success";
},
{ quality: 50, allowEdit: true, destinationType: navigator.camera.DestinationType.FILE_URI});
};
稍后的HTML
<img style="width:144px;height:144px;" id="camera_image1" src="nophoto.jpg"/>
但是,我想同時將圖像保存到用戶庫,因此非常感謝任何指針。
我嘗試使用captureImage,但這給了我較少的選擇,例如編輯,並且沒有將圖像內聯到html中。
再次感謝
PhoneGap 1.3
使用Phonegap 2.2,您可以將圖像保存到本地設備。
將"saveToPhotoAlbum : true"
添加到cameraOptions
function takePicture() {
navigator.camera.getPicture(
function(uri) {
var img = document.getElementById('camera_image1');
img.style.visibility = "visible";
img.style.display = "block";
img.src = uri;
document.getElementById('camera_status').innerHTML = "Success";
}, {
quality: 50,
allowEdit: true,
destinationType: navigator.camera.DestinationType.FILE_URI,
saveToPhotoAlbum : true
});
};
您將需要稍微更改一下電話間隙代碼。 它不會將圖像保存在當前在那里的實現中。 告訴我你是否正在使用phonegap android。 也許可以幫助您。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.