Displaying images from dataDirectory

#1

Hi, I’m storing a set of images that I downloaded from the server in the dataDirectory.
Now, I would like to display them inside my template. Is there a recommended way how the image should best be inserted?

I tried giving the ion-img or img-tag the complete path (file.dataDirectory + “myImg.jpg” -> “file:///data/user/0/io.ionic.starter/files/myImg.jpg” (stored in my imgPath variable, the path is written after the platform.ready event), but only a broken image symbol is shown. When accessing images from my assets folder I do not encounter any problems, but how can I access the dataDirectory’s images?

<img width=“200” height=“200” [src]=“imgPath” *ngIf=“imgPath”>

Thanks in advance.

1 Like
#2

have you find a solution, i’ve got the same problem for displaying img (jpg) from dataDirectory ?

#3

Same problem here. :frowning:

#4

I also meet that issue although I know the picture exists since I can open it with File Opener… A remark, in a past project it worked well, but the same code in a fresh project just created, it does not :frowning: