** Note you cannot use a URL, you must have access to the folders/files
scandir():
$dir = "PATH_TO_DIRECTORY";
$exclude = array( ".","..","error_log","_notes" );
if (is_dir($dir)) {
$files = scandir($dir);
foreach($files as $file){
if(!in_array($file,$exclude)){
echo '<li><img src="' . $dir . $file . '" /></li>';
}
}
}
readdir():
$dir = "PATH_TO_DIRECTORY";
$exclude = array( ".","..","error_log","_notes" );
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
if(!in_array($file,$exclude))
echo '<li><img src="' . $dir . $file . '" /></li>';
}
closedir($dh);
}
}?>