I have a mysql database which stores the paths of some images on a network drive.
I thought that using Ajax, I would be able to dynamically generate image tags to display these images in the browser as each image tag would inovoke a new GET request with the path relative to the browser.
The web server has a small HDD and I don't want to have to duplicate everything - so can't store large numbers of images on the server.
My PHP seems to generate the image tags correctly however the broswer does not show the images.
PHP code:
$sql = "SELECT ID,Link FROM tblStorePictures WHERE StoreNumber = $sto";
$result = mysql_query($sql,$dblink) or die(mysql_error());
$row = mysql_fetch_array($result);
$id = $row['ID'];
echo "<img src='file://".$row['Link']."' alt='Image' id=$id>";
The image tags (as viewed in firebug) end up looking like this:
<img id="57" alt="Image" src="file://x:/Image1.jpg">
I have tried various things but nothing works:
Dynamically generating the image tags with javascript using the document.createElement("img") method and setting attributes for the source etc.
Using javascript to set innerHTML.
In all cases I've got the tags to generate correctly, but I still see nothing in the browser but the alt text.
Any suggestions welcome.