Last Updated: February 25, 2016
·
728
· dubrod

Echo Images in Directory

$dir = "../directory/";

if (is_dir($dir)) {
    if ($dh = opendir($dir)) {
        while (false !== ($file = readdir($dh))) {
            if ($file != "." && $file != "..") { 
                echo "<img src=\"".$dir."".$file."\" width=\"150px\" class=\"singlePhoto\">";
            }
        }
        closedir($dh);
    }
}