Hey,
I have the following script and this works fine and echos all the photos listed in the directory!
PHP Code:
<?php
$image_dir = "clients/" . $_GET['imgdir'] . "/";
$image_dirb = "clients/" . $_GET['imgdir'] . "/";
/* settings */
$per_column = 100;
if(!opendir($image_dir)){
echo "<br><br>Oops... This album is lost!<br>Please contact me!";
}else{
/* step one: read directory, make array of files */
if ($handle = opendir($image_dir)) {
while (false !== ($file = readdir($handle)))
{
if ($file != '.' && $file != '..' && preg_match("/t/",$file) && $file != '_notes')
{
$files[] = $file;
}
}
closedir($handle);
}
$b = $_GET["bride"];
$g = $_GET["groom"];
/* step two: loop through, format gallery */
if(count($files)){
foreach($files as $file){
$count++;
$new_name = str_replace("t.jpg", ".jpg", $file);
echo '
<a href="?portal=view&groom=' . $g . '&bride=' . $b . '&imgdir=' . $image_dirb . '' . $new_name . '&file=' . $new_name . '">
<img src="' . $image_dirb . '' . $file . '" style="margin: 5px; padding: 4px; border: 1px solid #e8e8e8; background-color: white;" />
</a>
';
if($count % $per_column == 0) { echo ''; }
}}
else
{
echo "";
}
// End if no folder
}
?>
However I want it to only show 10 images at a time, then have page numbers for however many pages is needed and also be in file order as they are names 001.jpg, 002.jpg etc... but it doesnt seem to display them in order.
Help please!
Dan