dosya icinde cok fazla resim olursa, performansi biraz bozuk olabilir.. onuda ayarlarsin.. ,)
<?
$resim = $_REQUEST['resim'];
$dir = ".";
$readdir = opendir($dir) or die("hata");
$resimler = array();
while($write = readdir($readdir)){
	$file = strtolower( strrchr( $write , '.' ) );
	if($file == ".jpg" || $file == ".png" || $file == ".gif" || $file == ".jpeg" || $file == ".bmp"){
		array_push($resimler, $write);
	}
}
$sayi = count($resimler);
for($i = 1; $i < $sayi+1; $i++ ){
	echo "<a href=\"?resim=$i\">$i</a> ";
}
echo "<br />";
if(isset($resim)){
	$no = $resim-1;
	echo "<img src=\"$resimler[$no]\"><br />"; 
} else {
	echo "<img src=\"$resimler[0]\"><br />"; 
}
?>