Ionic Camera+Firebase - Additional data with the picture


#1

Dear Guys!
Here is my code, uploading the taken photo to a generated folder. (found this in a tutorial).
I would like to put a json file to that folder, containing the img url and additional string which will be given by the user before the upload process.

Can you pls help me how should i do that?

fotoKeszit() {
    this.camera.getPicture({
      quality: 100,
      destinationType: this.camera.DestinationType.DATA_URL,
      sourceType: this.camera.PictureSourceType.CAMERA,
      encodingType: this.camera.EncodingType.JPEG,
      saveToPhotoAlbum: true

    }).then(imgdata => {
      this.picdata = imgdata;
      this.feltoltesIndit();
    })
  }

  feltoltesIndit() {
    this.mypicref.child(this.uid()).child('pic.jpg')
      .putString(this.picdata, 'base64', { contentType: 'image/jpg' })
      .then(savepic => {
        this.picurl = savepic.downloadURL
      })
  }
  uid() {
    var d = new Date().getTime();
     var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx'.replace(/[xy]/g, function (c) { var r = (d + Math.random() * 16) % 16 | 0; d = Math.floor(d / 16); 
      return (c == 'x' ? r : (r & 0x3 | 0x8)).toString(16); }); return uuid;
  }