view.php
<?php
/******************************************************
<a href="view.php?dir=[location]">Photos</a>
where [location] is the pathname of the picture files
directory.
******************************************************/
session_start();
session_cache_limiter();
error_reporting(0);
include "view.inc";
$picturedir = $GET['dir'];
$strtdir = getcwd();
$ch = chdir ($picturedir);
$myhost = $SERVER['HTTP_HOST'];
if ($ch) include "view.inc";
$mydir = getcwd();
$tmp = chdir ($strtdir);
?>
<html>
<head>
<meta http-equiv="Pragma" content="no-cache">
<?php echo "<title>".$pgtitle."</title>\n"; ?>
<?php if ($stylesheet) echo $stylesheet; ?>
</head>
<?php echo "<body bgcolor=".$bgcolor." text=".$textcolor.">\n"; ?>
<H3 align="center">
Click on a picture to see it full-size.<br>
Use your browser BACK button to return here.</H3>
<center>
<table cellpadding=0 cellspacing=4>
<?php
$cellcount = 0;
$piccount = 0;
if (is_dir($picturedir)) {
if ($dh = opendir($picturedir)) {
while ($filename = readdir($dh)) {
if (basename($filename) != basename($filename,$exten)) {
$cellcount++;
$piccount++;
$picpath = $picturedir."/".$filename;
if ($cellcount == 1) echo "<tr>\n";
echo "<td align=\"center\" valign=\"bottom\"><a href=\"http://".$myhost."/".members."/".uploader."/"."/".$picturedir."/".$filename.";\">\n";
echo "<img src=\"http://".$myhost."/".members."/".uploader."/".$picpath.";\" width=".$tbwidth." border=0>";
echo "</a><br>\n";
$fnbase = basename ($filename,$exten);
$capname = $picturedir."/".$fnbase.$text;
$caption = "";
$fhandle = fopen ($capname, "r");
$caption = fgets ($fhandle, 80);
fclose ($fhandle);
echo $caption."</td>\n";
if ($cellcount == $picsrow) {
echo "</tr>\n";
$cellcount = 0;
}
}
}
closedir($dh);
}
}
if ($cellcount != 0) echo "</tr>\n";
echo "</table>\n";
?>
</body>
</html>
view.inc
<?php
$pgtitle = "Feature Girl Uploads";
$picsrow = "4";
$tbwidth = "160";
$stylesheet = '<LINK rel="stylesheet" href="">';
$bgcolor = "#ffffff";
$textcolor = "#000000";
$exten = ".jpg";
$text = ".txt";
?>
Now that I got my upload script working I need to get this working, it will display all the jpg files in a directory or all the gif files if I change it, but I need it to display all gif files and jpg files.
Thanks for any help