This is the code I'm using to get and display images from a folder on my server:
$root = realpath($_SERVER["DOCUMENT_ROOT"]);
$dirname = "$root/Folder/".$row['city']."/";
$images = glob($dirname."".$row['id']."@*.jpg");
foreach($images as $image) {
echo "<img src=\"".$image."\">";
}
The "normal" path of a picture is /Folder/Berlin/1@1.jpg
. In the rendered HTML source code I can see PHP makes this link: /var/www/user_name/html/Folder/Berlin/1@1.jpg
But unfortunately the image doesn't get loaded.
What am I doing wrong?