Установите плагин ImagePicker: 'плагин ionic cordova add cordova-plugin-telerik-imagepicker' - PullRequest
0 голосов
/ 17 июня 2019

Я использую Ionic 4, и я уже установил (добавив с помощью --save) плагин, но все еще получаю ту же ошибку, что я должен сделать, чтобы исправить это? Большое вам спасибо.

Привет

Мой код:

  constructor(private imagePicker: ImagePicker,
private afs: AngularFirestore,
private route: ActivatedRoute,
private nav: NavController,
private alertController: AlertController) {}

goPhotoGallery() {
//console.log("My storageRef: " + this.storageRef)
this.options = {
  maximumImagesCount: 3,
  // max width and height to allow the images to be.  Will keep aspect
  // ratio no matter what.  So if both are 800, the returned image
  // will be at most 800 pixels wide and 800 pixels tall.  If the width is
  // 800 and height 0 the image will be 800 pixels wide if the source
  // is at least that wide.
  width: 400,
  //height: 200,

  // quality of resized image, defaults to 100
  quality: 50,

  // output type, defaults to FILE_URIs.
  // available options are 
  // window.imagePicker.OutputType.FILE_URI (0) or 
  // window.imagePicker.OutputType.BASE64_STRING (1)
  outputType: 1
};
this.imageResponse = [];
this.imagePicker.getPictures(this.options).then(results => {
  for (var i = 0; i < results.length; i++) {
    //this.imageResponse.push('data:image/jpeg;base64,' + results[i]);
    this.storageRef.put('data:image/jpeg;base64,' + results[i])  // I'm trying to upload the files to Firestore but when i'm doing click on the icon to active this method it shows me an alert with plugin not installed and on my phone neither... I'm using Ionic Devapp to reproduce it, didn't try to make a sign and test it using the APK
      .then(function (snapshot) {
        console.log('Uploaded a blob or file!');
      });
  }
}, (err) => {
  alert(err);
});

}

...