$iterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator(
ABS_PATH.'/uploads/'
),
RecursiveIteratorIterator::SELF_FIRST
);
foreach($iterator as $file) {
if($file->isDir()) continue;
$real_path = $file->getRealPath();
$real_path = str_replace("\\", "/", $real_path);
$URL = str_replace($_SERVER["DOCUMENT_ROOT"], $_SERVER["SERVER_NAME"], $real_path);
$protocol = isset($_SERVER["HTTPS"]) ? 'https://' : 'http://';
$URL = $protocol.$URL;
echo '<img src="'.$URL.'" alt="" />';
}
Comente no