<?php

function photo_code($directory$photo_uri)
{
    if(
file_exists("$directory/$photo_uri"))
    {
        list(
$width$height) = GetImageSize("$directory/$photo_uri");
        
$width.="px";
        
$height.="px";

        print(
"<p><img src=\"$photo_uri\" style=\"width: $width; height: $height; border: 2px solid black; padding: 3px;\" alt=\"Photo $photo_uri\" /></p>\n");
        print(
"<p style=\"padding-bottom: 30px;\"><a href=\"?show=$photo_uri\" title=\"Unique page for this photo.\">$photo_uri</a></p>\n");
    }
}

if(isset(
$_GET["show"]))
{
    
$current_photo=$_GET["show"];
}


$dump_dir dir (".");
while(
$dumped_photo $dump_dir->read())
{
    
$extension substr(strrchr($dumped_photo,"."),1);
    if(
$extension=="jpg")
    {
        
$photos[]=$dumped_photo;
    }    
}
$this_dir=getcwd();
$dump_dir->close();
rsort($photos);
$path=explode("/"$this_dir);
$collection=$path[5];

// stuff maybe to edit

    
$dumps_root_directory "/dumps/";
    
$title 'Photo Dump ' $collection;
    
$description 'Dumped photographs on various topics.';             
    
$keywords 'photographs';         $created 'Dec. 2002';
    
$styles '
    
    #content { 
    background-color: #fff; 
    padding-top: 0px;
    }
    
    h1 {
    margin: 0px;
    }

    '
;
print(
"<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>\n");
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
    <title><?php print($title); ?></title>
    <meta name="author" content="Stephanie Booth (steph@climbtothestars.org)" />
    <meta name="description" content="<?php print($description); ?>" />
    <meta name="keywords" content="<?php print($keywords); ?>" />
    <meta http-equiv="Content-Type" content="text/HTML; charset=iso-8859-1" />
    <meta name="MSSmartTagsPreventParsing" content="TRUE" />
    
    <style type="text/css" media="all">
    <?php print($styles); ?>
    </style>    

</head>
<body>


<!-- Dumped Photos Script first developed by Stephanie Booth (http://climbtothestars.org/). View original code and vague tutorial here: http://climbtothestars.org/coding/dumpedphotos/. If you try to make money out of this, you will roast in hell. Modify and redistribute as you wish as long as this notice remains. -->


<div id="content">
<h1><a href="<?php print($dumps_root_directory); ?>" title="An index of the public galleries available here.">Dumped Photos</a>: <a href="<?php print("$dumps_root_directory$collection"); ?>/" title="Index for this photo collection."><?php print($collection); ?></a></h1>
<?php
if($current_photo=="list")
    {
?>
        <ul>
        <li><a href="?" title="View all photos.">ALL/TOUT</a></li>
        <?php

        
foreach($photos as $key => $photo)
        {
            print(
"<li><a href=\"?show=$photo\" title=\"View photo $photo.\">$photo</a></li>\n");
        }
        
?>

        </ul>

        <?php
    
}
    elseif(isset(
$current_photo))
    {
        
$dump_dir dir (".");
        do
        {
            
$this_one=$dump_dir->read();
        }
        while(
$this_one!=$current_photo);
        
        
$next_one=$dump_dir->read();
        
$dump_dir->close();
        print(
"<p style=\"text-align: right;\"><a href=\"?show=$next_one\" title=\"Next photograph.\">random photo &gt;&gt;&gt;</a></p>");
        
photo_code($this_dir$current_photo);
        print(
"<p><a href=\"?\" title=\"View all photos.\">all/toutes photos</a> | <a href=\"?show=list\" title=\"View text-only list of all photos.\">text only list</a></p>");
    }

else
{
        print(
"<p><a href=\"?show=list\" title=\"View text-only list of all photos.\">text only list</a></p>");
        foreach(
$photos as $key => $photo)
        {
            
photo_code($this_dir$photo);
        }

}
?>
<p>This dumped photos gallery is powered by some version of <a href="http://climbtothestars.org/coding/dumpedphotos/" title="Check out the original script.">Stephanie's script</a>.</p> 
</body>
</html>