Src={{ FILE_URL }} Produces Not allowed to load local resource error

Hi everyone,

On my app that uses my camera at the moment, I’m trying to take high quality images so I’m saving down the images first rather than base64 encoding them and moving them through each one of my screens.

I’ve got a preview of all the taken images in an ion-slides.

In the when I put the source as the FILE_URL from a list, it will product the following error: Not allowed to load local resource. Does anyone know why this might be? This seems to make sense but doesn’t work.

1 Like

Using android or ios??

Android but I don’t want this issue occurring on any other devices if I can help it

Ok so are you using it on a real device or emulator??? I would like to tell you it doesn’t works with live reload.

Hi,

I am using this on an actual device. I’m using ionic cordova run android to a device without the livereload option

can you show the code you’re using??

Ah that would help -

TS:

  options: CameraOptions = {
    correctOrientation: true,
    quality: 50,
    destinationType: this.camera.DestinationType.FILE_URI,
    encodingType: this.camera.EncodingType.JPEG,
    mediaType: this.camera.MediaType.PICTURE
  };

  capturePhoto() {
    this.camera.getPicture(this.options).then((imageData) => {
      // let base64Image = 'data:image/png;base64,' + imageData;
      this.looImages.push(imageData);

      console.log(this.looImages.length);
    }, (err) => {
      // Handle error
    });
  }

HTML

<ion-slide *ngFor="let looImage of looImages">
      <img src="{{ looImage }}" imageViewer ion-long-press
           (onPressing)="showImageOptions()"/>
    </ion-slide>

AS a side note, here is the full error: Not allowed to load local resource: file:///storage/emulated/0/Android/data/io.ionic.starter/cache/1537998538243.jpg

Did you use file permission??

The app has the permissions for Location, Camera and Storage

Try using file permission. It may help.

All file permissions have already been assigned. I’ve check them, and nothing is still working

same problem. Any solution??
please help.

I’m stuck for weeks whit this error.