Unable to Show local image file:///tmp/someimage.jpg #530

Closed
opened 2026-01-29 16:42:13 +00:00 by claunia · 4 comments
Owner

Originally created by @ctrl-alt-d on GitHub (Jul 15, 2020).

First, sorry about to post a question.

The issue is that I'm not able to show local images via <img src="file:///path/to/someimage.jpg ....

I posted the question on Stack Overflow 9 days ago:

Is someone so kind to give me instructions about how can I show on electron window picture files from local storage.

Thanks!!

Originally created by @ctrl-alt-d on GitHub (Jul 15, 2020). First, sorry about to post a question. The issue is that I'm not able to show local images via `<img src="file:///path/to/someimage.jpg ...`. I posted the question on Stack Overflow 9 days ago: * https://stackoverflow.com/questions/62741325/show-local-image-file-tmp-someimage-jpg _(+50 bounty)_ Is someone so kind to give me instructions about how can I show on electron window picture files from local storage. Thanks!!
claunia added the question label 2026-01-29 16:42:13 +00:00
Author
Owner

@IRHM commented on GitHub (Sep 8, 2020):

I'm having the same problem. I was able to use your workaround (converting image to base64), but a big problem for me is when trying to load a video file.

If the video file is big (~500mb) then converting to a base64 string will just take too long.

When loading a video/image (like: src="file:///path/to/video.mp4") the chrome console shows this error:

Error - Not allowed to load local resource

For blazor atleast, putting the video inside the wwwroot folder will allow it to load normally, but that isn't a real possibility for me.

@IRHM commented on GitHub (Sep 8, 2020): I'm having the same problem. I was able to use your workaround (converting image to base64), but a big problem for me is when trying to load a video file. If the video file is big (~500mb) then converting to a base64 string will just take too long. When loading a video/image (like: `src="file:///path/to/video.mp4"`) the chrome console shows this error: <p align="center"> <img src="https://user-images.githubusercontent.com/37304121/92503053-99a2fb00-f1f8-11ea-98da-71fd0e7243ba.png" alt="Error - Not allowed to load local resource" /> </p> For blazor atleast, putting the video inside the `wwwroot` folder will allow it to load normally, but that isn't a real possibility for me.
Author
Owner

@IRHM commented on GitHub (Oct 5, 2020):

Anything happening with this?

@IRHM commented on GitHub (Oct 5, 2020): Anything happening with this?
Author
Owner

@IRHM commented on GitHub (Oct 30, 2020):

@ctrl-alt-d @GregorBiswanger I think this is a bug

@IRHM commented on GitHub (Oct 30, 2020): @ctrl-alt-d @GregorBiswanger I think this is a bug
Author
Owner

@FlorianRappl commented on GitHub (Nov 7, 2025):

This is not a bug @IRHM - it's how Electron works (see, e.g., https://stackoverflow.com/questions/50272451/electron-js-images-from-local-file-system).

You will need to serve this file - i.e., just create an endpoint somewhere and this endpoint does the file system access. This way, your HTML code uses http -> communication with your ASP.NET server and then from this you load / transport the contents of the file from the local FS.

@FlorianRappl commented on GitHub (Nov 7, 2025): This is not a bug @IRHM - it's how Electron works (see, e.g., https://stackoverflow.com/questions/50272451/electron-js-images-from-local-file-system). You will need to serve this file - i.e., just create an endpoint somewhere and this endpoint does the file system access. This way, your HTML code uses http -> communication with your ASP.NET server and then from this you load / transport the contents of the file from the local FS.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#530