<?php 
$dir = 'images';
if(is_dir($dir)) {
	$openDir = opendir($dir);
	while(($file = readdir($openDir)) !== false) {
		if($file != "." && $file != "..") {
			echo $file.'<br>';
			$path = $dir.$files[$i];
			echo "<img src='$path' alt='' width='100' />";
			$k++;
		}
	}
	closedir($openDir);
}
?>  echo pathinfo($path, PATHINFO_EXTENSION);