<!--
Donated to Rapid Weaver community by Lanny Rosicky
The nice thing to do is not remove this note
You can modify this to change the looks image pop up window
-->
<style type="text/css" media="all">
img {
border-style: solid;
border-color: #000;
width: 200px;
}
h1 { color: navy; }
</style>
<script>
<!-- You can modify this to change the width and the location of the pop up window It is a simple pop up window function. -->
var newwindow;
function poptastic(url)
{
newwindow=window.open(url,'name','height=500,width=500','top=100','left=300');
if (window.focus) {newwindow.focus()}
}
</script>
<!-- Simple form to change the display type. action: The name of the program (zlistphoto.php) is the name of this progam -->
<form method="Post" action="zlistphoto.php" enctype="application/x-www-form-urlencoded" target="_self" name="xlist">
Select Output type and <input type="submit" value="Engage!"><br>
<input type="radio" name="typ" value="N" checked>Naked
<input type="radio" name="typ" value="P" >PopUp
<input type="radio" name="typ" value="T" >Thumbnails
</form>
<?php
/*
* This program relies on a functioning php support on the server.
*/
/* Configuration area */
/* prefix: The url of your server is figured out automatically
* but you can also assign it as long as the final result looks like
* http://www.example.com/
*/
$prefix = 'http://' . $_SERVER['HTTP_HOST'] . '/';
/*
* listtype
* N produces a list of valid urls for img inclusion
* T produces a page full of thumbnails of your images
* P produces a list of valid urls with a popup link
* The default is N and you can change that
*/
if (isset($_POST['typ'])) {
$listType = $_POST['typ'];
} else {
$listType = 'N'; // N = Naked
}
/*
* dir is the directory under your control and in your web domain.
* it is typically where you home page (index.html or index.php) is
*/
$dir = 'public';
/*
* extentions list of extention you want to be displayed - one extention per
* line without the dot follow by comma. The last entention in the list
* is not followed by a comma
*/
$extentions = array(
"jpg",
"JPG",
"png",
"PNG"
);
/*
* ----------------------------------------------------------------
* WARNING - stop modifying here unless you know what you are doing
* ----------------------------------------------------------------
*/
echo "<H1>Files in $prefix$dir</H1>";
$html = @filesInDir($dir, $prefix, $listType, $extentions);
echo $html;
exit;
function filesInDir($tdir, $prefix, $listType, $extentions) {
/*
* This is a recursive function looking for extentions in a directory tree
* starting with $tdir.
*/
$dirs = scandir($tdir);
foreach ($dirs as $file) {
if (($file == '.') || ($file == '..')) {
} elseif (is_dir($tdir . '/' . $file)) {
filesInDir($tdir . '/' . $file, $prefix, $listType, $extentions);
} else {
$foo = explode(".", $file);
/* Resolve multiple periods */
$fe = end($foo);
if (in_array($fe, $extentions)) {
if ($listType == "N") {
echo '<br>' . $prefix . $tdir . '/' . $file . ' ';
} elseif ($listType == "T") {
echo '<img src=' . $tdir . '/' . $file . ">" . ' ' . ' ';
} elseif ($listType == "P") {
echo '<br>' . $prefix . $tdir . '/' . $file . ' ';
echo '<a href="javascript:poptastic(\'' . $tdir . '/' . $file . '\');">PopUp</a>' . "\n";
}
}
}
}
}
?>