angular - 相机功能角离子不适用于android
问题描述
这是我打开相机并添加blob图片的功能,因此我可以将其发送到后端该功能适用于打开相机并大喊图像,但之后没有发生任何事情,它应该将图片添加到数组中
openCamera() {
this.j.push("p");
const options: CameraOptions = {
quality: 50,
destinationType: this.camera.DestinationType.DATA_URL,
encodingType: this.camera.EncodingType.JPEG,
mediaType: this.camera.MediaType.PICTURE,
allowEdit: true,
targetWidth: 640,
targetHeight: 640,
saveToPhotoAlbum: true,
cameraDirection: 1
}
this.camera.getPicture(options).then((imageData) => {
let base64Image = 'data:image/jpeg;base64,' + imageData;
this.noteImage=imageData;
console.log(base64Image);
this.alertService.presentToast("تم رفع الصور بنجاح");
var filename = base64Image.split("/").pop();
let blobimg = this.base64ToFile(base64Image)
let obj = {
fileName: filename,
imgBlob: blobimg,
file_Src: base64Image,
}
this.imageArr.push(obj);
}, (err) => {
// Handle error
this.j.push("e");
});
this.j.push("o");
}
之后没有错误捕获(imageData)相机打开放没有访问
this.imageArr.push(obj);
解决方案
推荐阅读
- javascript - 如何从给定的对象数组中获取这些对象数组?
- apache - 一些重定向怎么可能不起作用?
- sql - 查询会是什么?
- excel - 具有过滤行的结构化引用表公式
- jquery - 如何在jQuery中设置绝对位置
- android - AltBeacon 库中的 ScanPeriod 和 BetweenScanPeriod 是什么意思?
- visual-studio-code - 如何使用键盘快捷键打开和关闭 VS Code 扩展?(它有一个内置的开和关设置)
- prolog - 为什么无法运行此代码?什么是 ECLiPSe-clp 中的“语法错误:预期的后缀/中缀运算符”错误
- typescript - 当我使用泛型类型时,为什么“void”不适用于可选参数?
- deep-learning - 多输入 DNN 的 LIME 图像分类解释