captureImage() {
let This = this;
var cmr = plus.camera.getCamera(); //獲取攝像頭管理物件
var res = cmr.supportedImageResolutions[0]; //字串陣列,攝像頭支持的拍照解析度
var fmt = cmr.supportedImageFormats[0]; //字串陣列,攝像頭支持的拍照檔案格式
console.log("拍照解析度: " + res + ", 拍照檔案格式: " + fmt);
cmr.captureImage(
function(path) {
plus.gallery.save(path, params => {
this.compressImg(params.file);
alert(w)
});
//進行拍照操作
// 通過URL引數獲取目錄物件或檔案物件
plus.io.resolveLocalFileSystemURL(path, function(entry) {
var tmpPath = entry.toLocalURL(); //獲取目錄路徑轉換為本地路徑URL地址
This.imgSrc = tmpPath;
alert("拍攝成功: " + tmpPath);
});
},
function(error) {
//捕獲影像失敗回呼
alert("捕獲影像失敗: " + error.message);
},
{ resolution: res, format: fmt }
);
},
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/87085.html
標籤:移動開發其他問題
上一篇:求助大佬,幫忙搞定個任務
