I have a JSP page on which I have a div tag in which there is a a IMG tag. Using this IMG tag I want to show an image in it. Here the source path of an image is comes from database so I assigned a JSP variable using JSP scriplet. This JSP variable have the source path of an image.
This path of image may be of different machine or of same machine i.e. images are stored on different machine or on same machine i.e. on local machine on different drive.
The problem is that how to give path of image stored on different machine as well as on same machine. I have tried different ways like by giving ip address of that machine.
Here is the path that of local machine where the image is stored
img src= file:\localhost\D:\ScannedSheets\testproj/batch1/IMG001.jpg style=”z-index:1; position:absolute; top:0; left:0; width:850; height:1099″
With this syntax the image is visible in Internet Explorer but With the same syntax Its not visible in FireFox, Google Chrome etc.
Please Guide me in friends.
Also tell me that how to give path of the image stored on different machine which works In Internet Explorer, FireFox, Google chrome etc.
Don’t use absolute paths for img tags if you are going to publish this page on the internet. It will not work. Use relative path instead. You need to save your picture on the same directory level as you html page. For example if your page stored here: C:\Web\Page.html then put you picture here C:\Web\Images\IMG001.jpg.
And your code should look like this:
EDIT:
For remote server with picture handler:
You will need to implement image handler wich does the folowing:
Gets image path from db by image id
Returns image stream to client browser from identified path