Picture Description';
readfile("$galleryPic"."_desc");
print "
File: " . $pic . "
";
}
else
{
print 'Picture Description
';
print "no description available.";
print "File: " . $pic . "
";
}
print "";
}
showSections($galleryDir, $section, true);
function showSections($galleryDir, $showSec, $invert)
{
// Checks for all the sections in the gallery.
if (is_dir($galleryDir))
{
$dh = opendir($galleryDir);
while (false !== ($section = readdir($dh)))
{
if (is_dir("$galleryDir/$section") && strncmp($section, ".", 1)
&& (($invert == true && $section != $showSec) || ($invert == false && $section == $showSec)))
{
$sections[] = $section;
echo 'Section: ' . $section . '
';
picture($galleryDir, $section);
}
}
}
else
{
echo "gallery-directory not found: $galleryDir
";
}
}
function picture($galleryDir, $sectionDir)
{
$fullDir = "$galleryDir/$sectionDir";
// Checks for the Files in the subsection
if (is_dir($fullDir))
{
$dh = opendir($fullDir);
while (false !== ($fileName = readdir($dh)))
{
if (is_file("$fullDir/$fileName") /* file exists */
&& preg_match("/\.jpg/", $fileName) /* fileName is jpeg */
&& strncmp($fileName, ".", 1) /* FileName does not start with Dot */
&& !preg_match("/_thumb/", $fileName) /* fileName is not a ThumbNail */
&& !preg_match("/_desc/", $fileName)) /* fileName is not a description */
{
$pictures[] = preg_replace("/\.jpg/", "", $fileName);
}
}
sort($pictures);
/*$picsLeft = $picsPerRow;*/
for ($i = 0; $i < count($pictures); $i++)
{
print "
";
}
print"
\n";
}
}
?>