Read all sub directories and check images or read image
For Read all images from the specific folders use below code
$directories = glob($dir_path . '/*' , GLOB_ONLYDIR);
if(count($directories)>0)
{
foreach($directories as $sub_dir)
{
if(is_dir($sub_dir))
{
//$images = glob($sub_dir.'/' . "*.jpg");
$images = scandir($sub_dir.'/');
$scanned_directory = array_diff($images, array('..', '.'));
foreach($scanned_directory as $image)
{
echo '<img src="'.$sub_dir.'/' . $image .'" />';
}
}
}
}
Comments
Post a Comment