I have my images on a external hardrive connected to my mac. This code works as expected to show a image.
<img src="<?php echo get_path.php;?>?id=<?php echo $row['id'];?>">
Content of get_path.php below.
$id = $_GET["id"];
$result = mysql_query("SELECT path FROM images WHERE id = '$id'");
$row = mysql_fetch_array($result);
header('Content-type: image/jpeg');
readfile($row['path']);
Now to my question. I want to use the same image in this javascript code.
document.getElementById("image_holder").innerHTML="<img src="image.png"/>";
How to use the php readfile in javascript?