not tested, you need debug yourself
<?PHP
function listFiler($folder) {
if($bib = @opendir($folder)) {
/**
* Read the file names, imagesize into array
*/
while (false !== ($fil = readdir($bib))) {
if($fil != "." && $fil != ".." && !ereg("^..+", $fil)) {
list($w, $h, $x, $x) = getimagesize( $folder.'/'.$fil );
$arr_files[] = array('filename'=>$fil, 'w'=>$w, 'h'=>$h, 'x'=>$x, 'x'=>$x);
}
}
/**
* sort the array by filename
*/
for ($counter_1 = 0; $counter_1 < sizeof($arr_files); $counter_1++){
for ($counter_2 =$counter_1 + 1 ; $counter_2 < sizeof($arr_files); $counter_2++){
if ($arr_files[$counter_1]['filename'] > $arr_files[$counter_2]['filename']){
$temp_arr = $arr_files[$counter_1];
$arr_files[$counter_1] = $arr_files[$counter_2];
$arr_files[$counter_2] = $temp_arr;
}
}
}
/**
* set html
*/
for ($i = 0; $i < sizeof($arr_files); $i++){
$fil_liste[] = "<a href=\"java script:popit('{$folder}/{$fil}', {$w}, {$h})\"><img src=\"$folder/$fil\" width=\"100px\" height=\"100px\" border=\"0\" alt=\"$fil\" title=\"$fil\" style=\"border:1px solid #333;\"></a>";
}
}
}
closedir($bib);
if(is_array($fil_liste)) {
$liste = join(" ", $fil_liste);
} else {
$liste = "No files...";
}
return ""
. "$liste";
} else {
die("Could not open: " . $folder);
}
}
echo listFiler("photos"); //Choose folder.
?>