Hello. I have written a thumbnail/gallery script wich output
all jpg/image files in a directory. However I want the script to
list out 7 thumbnail images per row.
The problem with my script is that it only list out the first
7 images, and not the rest. How do I solve this ?
<?php
$folder = "thumb";
$open = opendir($folder) or die ($php_errormsg);
$files = array();
while($file = readdir($open)) {
if($file=='.' or $file=='..' or ereg('txt|index',$file)) { }
else {
$files[] = "$file";
}
}
closedir($open);
sort($files);
reset($files);
for($i=0; $i<count($files); $i++) {
if($i<7) {
print "<a href=main/$files[$i]><img src=thumb/$files[$i] border=0></a> ";
}
else {
print "<br>";
}
}
?>