využij toto
<?php
$soubor = glob('soubory/*.{jpg,jpeg,png,gif,JPG,JPEG,PNG,GIF}',GLOB_BRACE);
if(!isset($_GET["strana"]))
{$_GET["strana"]=0;}
echo "<img src=\"".$soubor[$_GET["strana"]]."\" border=\"0\"><br>";
if(($_GET["strana"])!=0)
{echo "<a href=\"index.php?strana=".($_GET["strana"]-1)."\"> zpet</a><br>";}
if(count($soubor)>($_GET["strana"]+1))
{echo "<a href=\"index.php?strana=".($_GET["strana"]+1)."\"> dalsi</a><br>";}
?>