首页 > 解决方案 > 相机功能角离子不适用于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);

标签: angularionic-frameworkcameraandroid-camera

解决方案


推荐阅读