I have a server running serving a HTML page and would like to serve an image residing in a local drive in Linux. I read that I can get that to work with appending file://..
. However, it doesn't seem to work in my case and I am suspecting that it might not work in my machine (Ubuntu 18.04). There's no error arose, just the img
doesn't seem to find the image.
<img src="file:///home/my_user/my_picture.png">
Image result from code snippet above:
In this thread, I found an answer saying that the modern browser doesn't allow to serve local file for security reason.
If this is the case, is there any alternative for this?
I am thinking of passing the image byte data to the client and let the client-side javascript construct the image. But, my concern is the performance issue when there are a lot of image to be transferred. Also, I think it's quite ugly since the client is guaranteed to be in the same machine as the server.