Thank you so much for the help. I placed the code in my page; but the order of the pics being displayed is no where near sorted. Here is the order it listed 14 pictures in a 6 column, 3 row table (L to R, T to 😎:
002, 003, 006, 007, 010, 014
011, 012, 013, 008, 009, 004
005, 001
I've been banging my friggin head on the wall and can't figure it out. I'm sure it's probably something really simple I just haven't recognized yet; but I need another opinion. Thanks again for any help!
<html>
<title>Photos you want to see!</TITLE>
<head></head>
<?php
global $bg_color;
$file="bin/bpa.ini";
$fp = fopen($file,"r");
$title = trim(fgets($fp, 4096));
$title_font = trim(fgets($fp, 4096));
$title_size = trim(fgets($fp, 4096));
$title_bold = trim(fgets($fp, 4096));
$title_color = trim(fgets($fp, 4096));
$bg_color = trim(fgets($fp, 4096));
$caption_font = trim(fgets($fp, 4096));
$caption_size = trim(fgets($fp, 4096));
$caption_bold = trim(fgets($fp, 4096));
$caption_color = trim(fgets($fp, 4096));
$caption_rollover = trim(fgets($fp, 4096));
$thumbnail_width = trim(fgets($fp, 4096));
$thumbnails_per_row = trim(fgets($fp, 4096));
$show_dimensions = trim(fgets($fp, 4096));
$show_filename = trim(fgets($fp, 4096));
fclose($fp);
echo "<body link=\"$caption_color\" vlink=\"$caption_color\" alink=\"$caption_rollover\" text=\"$title_color\" bgcolor=\"$bg_color\">";
echo "<style fprolloverstyle>A:hover {color: $caption_rollover;}</style>";
$picdir = trim($_GET["folder"]);
//////////////////////////
$column_width = 100 / $thumbnails_per_row; // Figures out percentage of screen each column should take up
$rowcount = 0;
echo "<center>";
echo "<font face=\"$title_font\" size=\"$title_size\">";
if ($title_bold == "checked") {
echo "<b>"; }
echo "$title</font>";
if ($title_bold == "checked") {
echo "</b>"; }
echo "<table border='0' cellpadding='5' cellspacing='5' style='border-collapse: collapse' width='100%' id='AutoNumber1'>";
echo "<tr>";
if ($handle = opendir("albums/$picdir")) {
// Start the image array
$imageArray = array();
while (false !== ($file = readdir($handle))) {
$pos = strrpos($file, "."); // finds the position of the right-most period in the file name (the extension)
$ext = substr($file, $pos, 5); // puts the file's extension into $ext
$ext = strtolower($ext); // converts the extension to all lowercase
$num = substr($file, $pos, -3); // Get the last 3 characters from filename (should be number of file i.e. 001)
if ($ext == ".jpg" || $ext == ".jpeg" || $ext == ".gif" || $ext == ".png") { // only show image if it is a valid graphics file
$imageArray[intval($num)] = $file;
}
krsort($imageArray);
foreach($imageArray as $file) {
// Rest of original code
echo "<td align='center' width=$column_width>";
echo "<font face='$caption_font' size='$caption_size' color='$caption_color'>";
if ($caption_bold == "checked") {
echo "<b>"; }
$size = getimagesize ("albums/$picdir/$file");
$image_ratio = $size[1] / $size[0];
$thumb_height = $thumbnail_width * $image_ratio;
echo "<a href=\"bin/view.php?image=$picdir/$file";
echo "&bg=$bg_color\" target='_self' style=\"text-decoration: none\">";
echo "<img border=0 src ='albums/$picdir/$file' width='$thumbnail_width' height='$thumb_height'><br>";
if ($show_dimensions="checked")
echo "</a>";
echo "</td>";
$rowcount++;
if ($rowcount >= $thumbnails_per_row)
{
echo "</tr>";
echo "<tr>";
$rowcount=0;
}
}
}
closedir($handle);
}
// Close out the table
echo "</tr>";
echo "</table>";
echo "<p>";
echo "<input type=\"button\" value=\"Go Back\" onclick=\"history.go(-1)\">";
echo "<br>";
echo "</center>";
echo "</font>";
?>
</body>
</html>