PHP Script to list and display all images in a directory

<?php
 
$path = "./";
$dir_handle = @opendir($path) or die("Unable to open folder");
 
while (false !== ($file = readdir($dir_handle))) {
 
	if (strpos($file,'.jpg') ||strpos($file,'.gif')||strpos($file,'.png')) {
		echo "<img src='$file' alt='$file'><br />";
	}
}
closedir($dir_handle);
 
?>

Demo