Image preview not available using fileuri

Hi,
I want to preview the image which is captured . I am not able to get the preview of the image bay using fileuri, any suggestion… Below my code

 capturePicture(){
    const option: CameraOptions = {
      quality: 50,
      destinationType: this.camera.DestinationType.FILE_URI,
      encodingType: this.camera.EncodingType.JPEG,
      mediaType: this.camera.MediaType.PICTURE,
    }
    this.camera.getPicture(option).then((imageData) => {
      this.capturedUrl =  imageData;
            }, (err) => {
      // Handle error
     });
  }
<button ion-button block  (click)="capturePicture()" >
          <ion-icon name="camera"></ion-icon>
          Camera
        </button>
<img [src] = "capturedUrl" />

i solved this issue by doing as below . i think it will help someone.

this.file.resolveLocalFilesystemUrl(imageData).then((entry:any)=>{
    entry.file((file1)=>{
    var reader = new FileReader();
    reader.onload =  (encodedFile: any)=>{
      var src = encodedFile.target.result;
      this.image = src;       
      }
    reader.readAsDataURL(file1);   
  })
}).catch((error)=>{
  console.log(error);
})
1 Like

Hi, Looks like you have solved the issue, can you please explain how are you using the code for the solution? thanks.

i just converted the fileuri image to datauri and displayed the image