I am trying to create a photo gallery with a php script that searches for directories and images contained within. Each subdirectory is a seperate gallery on the page. For each gallery, one image is used as a thumbnail image and the rest are to be placed into a hidden div. The problem is that only the last element of the array seems to be available.
[php]
<?php $gallery = './gallery'; if ($handle = opendir($gallery . '/')) { while ($folder = readdir($handle)) { if ($folder != '.' && $folder != '..') { $folderArray = array( $folder ); foreach ($folderArray as $folderName) { if ($set = opendir("$gallery/$folderName")) { $count = "0"; while ($image = readdir($set)) { if ($image != '.' && $image != '..') { $setArray = array( $image ); $count++; } //$image != '.' && $image != '..' } //$image = readdir($set) } //$set = opendir("$gallery/$folderName") echo ""; echo "";
echo "
";
echo "
";
echo "" . $count . " Photos
";
echo "" . $folderName . "
";
//***
echo "";
foreach ($setArray as $hiddenImage) {
echo "this is the hidden image stuff" . $hiddenImage;
} //$setArray as $hiddenImage
echo "
";
//***
// echo "hidden
";
echo ""; } //$folderArray as $folderName } //$folder != '.' && $folder != '..' } //$folder = readdir($handle) } //$handle = opendir($gallery . '/') ?>
[/php]
I am completely new at this and my code probably stinks. Any help would be appreciated.