Hey Guys,
I want to thank you for all of the help you offered on this problem. The solution offered did not work but it put me kinda on the right track. I am posting the full code for free use if you want it, Just keep my name in there somewhere. What this script will do is automatically publish pictures that are in a folder to the web. It will use the current directory structure to orginize them. I think it is cool but to each his/her own.
<?
Header('Cache-Control: no-cache');
Header('Pragma: no-cache');
?>
<?
////////////////////////////////////////////////////
//This Page will serve the photos that are stored //
//on the webserver to an intranet webpage. All //
//pictures and directories are automatically //
//updated when the contents change. //
// //
//Designed by: Michael Pelletier //
//Updated on: 12-AUG-2005 //
////////////////////////////////////////////////////
////////////////////////////////////////////////////
// Start: Variables //
////////////////////////////////////////////////////
//$limit is a variable that states how many //
//pictures can be displayed per page. //
// //
//$rootdir is the directory on the server where //
//Photo.php is stored. There should be no other //
//files except pictures, directories, and //
//photo.php stored in this path. //
// //
//$foldericonpath is the path to the folder icon //
//that you want to use for the site //
// //
//$dirname is the path on the server where the //
//files and directories are stored. This is the //
//location where php will read if there are files.//
// //
//$rownumcount is the number of pictures that will//
//show per row on a page. //
////////////////////////////////////////////////////
$rownumcount = 6;
$limit=24;
$foldericonpath = "HTTP path to the folder icon you wish to use";
$rootdir = "HTTP path to the directory where your pics and folders are stored";
$dirname = "Path to the actual directory ex.. /inetpub/wwwroot/dev/PhotoArchive/";
////////////////////////////////////////////////////
// End: Variables //
////////////////////////////////////////////////////
////////////////////////////////////////////////////
// Start: Open and Read //
////////////////////////////////////////////////////
//This section opens and reads the contents of the//
//folder that is stated in $dirname. If the //
//$_GET['path'] variable is not set then it will //
//default to the path //
//"/inetpub/wwwroot/dev/PhotoArchive/" //
// //
//The echo command starts the table formatting //
//for the directories that are going to be //
//written from the $dir variable //
// //
//The second part of this section is to input //
//the file contents into an array, $pics, and //
//store them with htmls tags for use later. //
////////////////////////////////////////////////////
ECHO "<CENTER><H1>".substr($_GET['path'], 0, -1)."</H1></CENTER>";
//ECHO $dirname.$_GET['path'];
$_GET['num']=$_GET['num']+1;
$dh = opendir($dirname.$_GET['path']);
echo "<CENTER><TABLE border='0' cellspacing='20' align='top'><TR width='100%'>";
while ($file = readdir($dh)) {
if (is_dir($dirname.$_GET['path'].$file) and $file != "." and $file != ".." and $file != 'Folder Settings' and $file != 'folder settings' )
{
if ($dcount == $rownumcount)
{echo "</TR><TR>";
$dcount=0;}
$dir= ("<TD valign='top' align='center' width='150'><A border='0' href='".$rootdir."Photo.php?path=".$_GET['path'].basename($file)."/&multipage=1'><CENTER><img src='".$foldericonpath."' width='50' height='50'></img></CENTER></a><BR>".$file."</TD>");
$dcount=$dcount+1;
echo $dir;}
elseif ($file != "." and $file != ".." and $file != "Photo.php" and $file != $dir and $file != 'Upload.php' and $file != 'log.txt' and $file != 'Desktop.ini' and $file != 'desktop.ini' and $file != 'Folder Settings' and $file != 'folder settings' )
{$pics[$_GET['num']] = ("<TD valign='top' align='center' width='150'> <A border='100' href='".$rootdir.$_GET['path'].basename($file)."'><img src='".$rootdir.$_GET['path'].basename($file)."' width='100' height='100'></img></a><BR> ".substr($file, 0, -4)." </TD>");
$_GET['num']=$_GET['num']+1;
}
}
closedir($dh);
////////////////////////////////////////////////////
// End: Open and Read //
////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
// Start: Dynamic Data Display //
////////////////////////////////////////////////////////////
//This section is where the pages decides what to //
//display depending on what variables are set or //
//what they are equal to. The statement //
//if ($_GET['multipage'] == 1) means that this //
//needs to be set in the browser by using the //
//following format: //
//http://webserver/dev/PhotoArchive/Photo.php?&multipage=1//
////////////////////////////////////////////////////////////
echo "</TR><TR>";
if ($_GET['multipage'] == 1)
{
if(isset($_GET['in']))
{
//$fcount=-1;
$tcount=0;
while($_GET['in'] != 0 and $tcount != $limit)
{
if ($fcount == $rownumcount)
{echo "</TR><TR>";
$fcount=0;}
else
{echo $pics[$_GET['in']];
$_GET['in']=$_GET['in']-1;
$tcount=$tcount+1;
$fcount=$fcount+1;}
}
if ($_GET['in'] <= 0)
{
echo "</table><table width='300' align='center'><tr width='100%'><td width = '40%' align = 'right'><a href = 'javascript:history.back()'> <<Previous Page </a></td>";
echo "<td width = '20%' align = 'center'><A href='".$rootdir."Photo.php?&multipage=1'>Home</A></td><td width = '40%' align = 'left'> </td></tr>";
}
ELSE
{
$_GET['out']=$_GET['in'];
echo "</table><table width='300' align='center'><tr width='100%'><td width = '40%' align = 'right'><a href = 'javascript:history.back()'> <<Previous Page </a></td>";
echo "<td width = '20%' align = 'center'><A href='".$rootdir."Photo.php?&multipage=1'>Home</A></td>";
echo "<td width = '40%' align = 'left'><A href='".$rootdir."Photo.php?path=".$_GET['path']."&in=".$_GET['in']."&multipage=1'>Next Page>></A></td></tr>";
}
}
else
{
$_GET['in']=$_GET['num'];
$fcount=-1;
$tcount=-1;
while($_GET['in'] != 0 and $tcount != $limit)
{
if ($fcount == $rownumcount)
{echo "</TR><TR>";
$fcount=0;}
else
{echo $pics[$_GET['in']];
$_GET['in']=$_GET['in']-1;
$tcount=$tcount+1;
$fcount=$fcount+1;}
}
if ($_GET['in'] == 0)
{
if (isset($_GET['path']))
{
echo "</table><table width='300' align='center'><tr width='100%'><td width = '40%' align = 'right'><a href = 'javascript:history.back()'> <<Previous Page </a></td>";
echo "<td width = '20%' align = 'center'><A href='".$rootdir."Photo.php?&multipage=1'>Home</A></td><td width = '40%' align = 'left'> </td></tr>";
}
}
ELSE
{
$_GET['out']=$_GET['in'];
if ($path == NULL )
{
echo "</table><table width='300' align='center'><tr width='100%'><td width = '40%' align = 'right'><a href = 'javascript:history.back()'> <<Previous Page </a></td>";
}
echo "<td width = '20%' align = 'center'><A href='".$rootdir."Photo.php?&multipage=1'>Home</A></td>";
echo "<td width = '40%' align = 'left'><A href='".$rootdir."Photo.php?path=".$_GET['path']."&in=".$_GET['in']."&multipage=1'>Next Page>></A></td></tr>";
}
}
}
ELSE
{
$fcount=0;
$tcount=0;
while($_GET['out'] != 0 and $tcount != $limit)
{
if ($fcount == $rownumcount)
{echo "</TR><TR>";
$fcount=0;}
else
{echo $pics[$_GET['out']];
$_GET['out']=$_GET['out']-1;
$tcount=$tcount+1;
$fcount=$fcount+1;}
}
if ($_GET['out'] <= 0)
{
echo "</table><table width='300' align='center'><tr width='100%'><td width = '40%' align = 'right'><a href = 'javascript:history.back()'> <<Previous Page </a></td>";
echo "<td width = '20%' align = 'center'><A href='".$rootdir."Photo.php?&multipage=1'>Home</A></td><td width = '40%' align = 'left'> </td></tr>";
}
ELSE
{
$_GET['in']=$_GET['out'];
echo "</table><table width='300' align='center'><tr width='100%'><td width = '40%' align = 'right'><a href = 'javascript:history.back()'> <<Previous Page </a></td>";
echo "<td width = '20%' align = 'center'><A href='".$rootdir."Photo.php?&multipage=1'>Home</A></td>";
echo "<td width = '40%' align = 'left'><A href='".$rootdir."Photo.php?path=".$_GET['path']."&in=".$_GET['in']."&multipage=1'>Next Page>></A></td></tr>";
}
}
////////////////////////////////////////////////////////////
// End: Dynamic Data Display //
////////////////////////////////////////////////////////////
?>