Reputation: 209
I am trying to make gallery which displays all the .jpg files in some local directory, but it makes me problem.
<?php
$directory = "img/";
$images = glob($directory."*.jpg");
foreach($images as $image)
{
echo '<img src="file://'.$image.'" /><br />'
}
?>
Somehow path to jpg file is not correctly passed to the src attribute, where I am wrong?
Upvotes: 0
Views: 146
Reputation: 126
Just remove the file:// on the src.
from
echo '<img src="file://'.$image.'" /><br />';
to
echo '<img src="'.$image.'"/><br />';
Upvotes: 1