Menu
Is there a way “view as thumbnails” option… for the web forlder content (images only, or any content)? Kind of as if you were “exploring” a folder?
you can use an .htaccess file to do this if I am not mistaken[/QUOTE]Really? How?
Really? How?[/QUOTE]
[code=php]
<?php
if(isset($_GET['src'])){
// The file
$filename = $_GET['src'];
// Set a maximum height and width
$width = 70;
$height = 70;
// Content type
header('Content-type: image/jpeg');
// Get new dimensions
list($width_orig, $height_orig) = getimagesize($filename);
if ($width && ($width_orig < $height_orig)) {
$width = ($height / $height_orig) * $width_orig;
} else {
$height = ($width / $width_orig) * $height_orig;
}
// Resample
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
// Output
imagejpeg($image_p, null, 100);
}else{
echo <<<END
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta name="resource-type" content="document" />
<meta name="description" content="Thumbnails." />
<meta name="keywords" content="Thumbnails" />
<meta name="distribution" content="global" />
<style type="text/css">
ul#gallery {
margin:0 auto;
padding:0;
list-style-type:none;
width:90%;
}
ul#gallery li {
float: left;
margin:20px;
height:125px;
}
ul#gallery li img {
border: 0;
}
ul#gallery li p {
text-align: center;
margin:5px 0;
}
ul#gallery li p a {
text-decoration: none;
}
</style>
<title>Thumbnails</title>
</head>
<body>
<ul id="gallery">
END;
$dir = opendir($_SERVER['DOCUMENT_ROOT'] . dirname($_SERVER['PHP_SELF']));
while (false !== ($file = readdir($dir))) {
if (eregi('.jpg{1}$', $file)){
print ('<li><a href="' . $file . '"><img src="thumbnail.php?src=' . $file . '"></a><p><a href="' . $file . '">' . str_replace('.jpg', '', $file) . '</a></p></li>'. "n");
}
}
closedir($dir);
echo <<<END
</ul>
</body>
</html>
END;
}
?>
[/code]
[code=php]
<?php
clearstatcache();
/***
Dynamic Directory Listing Script by Jona
***/
if(isset($_GET["phpinfo"])){
phpinfo();
exit;
}
if(isset($_GET["extns"])){
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css"><!--
body {
background-color: #CCC;
color: black;
font-family: arial, sans-serif;
font-size: small;
}
h1 {background-color: #AAA;
padding: 10px;
border: solid 1px black;
margin-bottom: 0px;
font-size: medium;
font-weight: normal;}
ul {margin-top: 0px;
padding-top: 5px;
padding-bottom: 5px;
list-style:square;
background-color: #999;
border:solid 1px black;}
--></style>
<title>Installed PHP Extensions</title>
</head>
<body>
<h1>Below is a list of the installed PHP extensions on this server.</h1>
<ul><?php
$extns = get_loaded_extensions();
for($j=0; $j<count($extns); $j++)
{echo("<li>". ucwords($extns[$j]) ."</li>");}
?></ul>
</body></html><?
exit;
}
// time begin
$sTime = time();
// directory name
$dir = getcwd();
// icons to use
$icons = array("htm" => "html.gif", "html" => "html.gif", "php" => "php.gif", "." => "dir.gif", ".." => "dir.gif", "gif" => "gif.gif", "jpg" => "jpg.gif", "jpeg" => "jpg.gif", "png" => "png.gif", "" => "dir.gif", "shtml" => "shtml.gif", "txt" => "txt.gif", "text" => "txt.gif", "dir" => "dir.gif");
/* Default method of sorting, values can be: "alpha" for alphabetical sorting of the files names, "type" for alphabetical sorting of the file types, or "size" for sorting by file size. */
$sortby = "alpha";
// Alternation class name
$class = " class="odd"";
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Directory Listing of <?php echo($dir); ?></title>
<style type="text/css"><!--
/* General colors and layout */
body {
background-color: #DDD;
color: black;
font-family: arial, sans-serif;
font-size: small;
}
a:link {
color: black;
background-color:transparent;
}
a:visited {
color:dimgray;
background-color:transparent;
}
a:hover {
color: white;
background-color:transparent;
}
/* Table colors and layout */
tr {border-bottom:solid 1px black;}
table.dirList {
width: 100%;
color: black;
border:solid 1px black;
}
.dirList th {
color: black;
font-weight: normal;
background-color: #999;
font-size: 1.2em;
letter-spacing: -1px;
}
.dirList tr.odd {
color: black;
font-weight: normal;
background-color: #AAA;
padding-left: 1em;
padding-bottom: 0.2em;
}
.dirList tr {
color: black;
font-weight: normal;
background-color: #CCC;
padding-left: 1em;
padding-bottom: 0.2em;
}
--></style>
</head>
<body>
<table class="dirList" cellspacing="0" summary="A list of the files and folders located in this area of the site.">
<tr>
<th width="50%" style="text-align: center;">File Name</th>
<th width="10%" style="text-align: left;">File Type</th>
<th width="15%" style="text-align: right;">File Size</th>
<th width="8%" style="text-align: right;">Perms</th>
<th width="15%" style="text-align: right;">Last Modified</th>
</tr>
<?php
function du($location) {
if (!$location or !is_dir($location)) {
return 0;
}
$total = 0;
$all = opendir($location);
while ($file = readdir($all)) {
if (is_dir($location.'/'.$file) && $file != ".." && $file != ".") {
$total += du($location.'/'.$file);
unset($file);
}
elseif (!is_dir($location.'/'.$file)) {
$stats = stat($location.'/'.$file);
$total += $stats['size'];
unset($file);
}
}
closedir($all);
unset($all);
return number_format($total/1000, 2, '.', ',');
}
$dh = opendir($dir);
if(isset($_GET["sort"])){ $sortby = $_GET["sort"]; }
while (false !== ($filename = readdir($dh))) {
$files[] = $filename;
}
for($k=0; $k<count($files); $k++){
$k2[] = explode(".", $files[$k]);
$k3[] = $k2[$k];
}
$k3 = array_slice($k3, 1);
for($b=0; $b<count($k3); $b++){
krsort($k3[$b]);
}
sort($k3);
if($sortby == "alpha")
{
sort($files);
for($f=0; $f<count($files); $f++)
{
$fType = explode(".", $files[$f]);
$fSize = filesize($files[$f])/1000;
if(!isset($fType[1]))
{
$_fSize = 0;
if($class != "")
{$class="";} else { $class=" class="odd"";}
echo("<tr".$class."><td><img src="". $icons["dir"] .""> <a href="". $files[$f] ."/">". $fType[0] ."</a></td>n");
echo("<td>Directory</td>");
echo("<td style="text-align:right;">". du($files[$f]) ." Kb</td>");
$perms = base_convert(fileperms($files[$f]), 10, 8);
$perms = substr($perms, (strlen($perms) - 3));
echo("<td style="text-align:right;">". $perms ."</td>");
$stat = stat($files[$f]);
echo("<td style="text-align:right;">". date("M. d, Y", $stat['mtime']) ."</td>");
}
}
for($f=2; $f<count($files); $f++)
{
$fType = explode(".", $files[$f]);
$fSize = number_format(filesize($files[$f])/1000, 2, '.', ',');
if(isset($fType[1]))
{
if(!isset($icons[$fType[1]]))
{ $icons[$fType[1]] = "unknown.gif"; }
if($class != "")
{$class="";} else { $class=" class="odd"";}
echo("<tr".$class."><td><img src="". $icons[$fType[1]] .""> <a href="". $files[$f] ."">". $fType[0] ."</a></td>n");
echo("<td>". strtoupper($fType[1]) ."</td>n");
echo("<td style="text-align: right">". $fSize ." Kb</td>");
$perms = base_convert(fileperms($files[$f]), 10, 8);
$perms = substr($perms, (strlen($perms) - 3));
echo("<td style="text-align:right;">". $perms ."</td>");
$stat = stat($files[$f]);
echo("<td style="text-align:right;">". date("M. d, Y", $stat['mtime']) ."</td>");
}
}
}
if($sortby == "type")
{
for($a=0; $a<count($k3); $a++)
{
if(!empty($k3[$a][1]) && !empty($k3[$a][0]))
{
$fSize = filesize($k3[$a][0] .".". $k3[$a][1]) /1000;
if($class != "")
{$class="";} else { $class=" class="odd"";}
echo("<tr ". $class.">n<td><img src="". @$icons[$k3[$a][1]] .""> <a href="". $k3[$a][0] .".". $k3[$a][1] ."">". $k3[$a][0] ."</a></td>n");
echo("<td>". strtoupper($k3[$a][1]) ."</td>n");
echo("<td style="text-align: right;">". $fSize ." Kb</td>n");
$perms = base_convert(fileperms($k3[$a][0].".".$k3[$a][1]), 10, 8);
$perms = substr($perms, (strlen($perms) - 3));
echo("<td style="text-align:right;">". $perms ."</td>n");
$stat = stat($k3[$a][0].".".$k3[$a][1]);
echo("<td style="text-align:right;">". date("M. d, Y", $stat['mtime']) ."</td>n</tr>n");
} else {
$_fSize = du($k3[$a][0]);
if(!empty($k3[$a][0]))
{
if($class != "")
{$class="";} else { $class=" class="odd"";}
echo("<tr ". $class .">n<td><img src="". $icons['dir'] .""> <a href="". $k3[$a][0] ."/">". $k3[$a][0] ."</a></td>n");
echo("<td>Directory</td>n");
echo("<td style="text-align: right;">". $_fSize ." Kb</td>n");
$perms = base_convert(fileperms($k3[$a][0]), 10, 8);
$perms = substr($perms, (strlen($perms) - 3));
echo("<td style="text-align:right;">". $perms ."</td>n");
$stat = stat($k3[$a][0]);
echo("<td style="text-align:right;">". date("M. d, Y", $stat['mtime']) ."</td>n</tr>n");
}
}
}
}
?>
</table>
<div style="background-color: #AAA; color: black; padding: 2px; border: solid 1px black; font-size: small;">
<p>Processing time: <?php echo(time() - $sTime); ?> seconds.</p>
<p>This document, located at <span style="font-family:monospace;"><?php echo($dir . str_replace("/", "\", $_SERVER["PHP_SELF"])); ?></span>, was last modified on <?php echo(date("M d, Y", getlastmod())); ?>.</p>
<p>Powered by...<br>
<a href="http://www.php.net/" title="Go to PHP.net"><img src="<?php echo($_SERVER["PHP_SELF"] . "?=". php_logo_guid()); ?>" alt="Powered by PHP version <?php echo(phpversion()); ?>!" style="border:none;"></a> <a href="http://www.zend.com/" title="Go to Zend.com"><img src="<?php echo($_SERVER["PHP_SELF"]."?=". zend_logo_guid()); ?>" alt="Powered by Zend version <?php echo(zend_version()); ?>!"></a></p>
<p style="margin-top: -50px; text-align: right;">
<a href="index.php?phpinfo">PHP Information</a> |
<a href="index.php?extns">Installed PHP Extensions</a> |
<a href="index.php?sort=alpha">Sort Alphabetically</a> |
<a href="index.php?sort=type">Sort by Type</a></p>
<br></div>
</body></html> [/code]
Sorry, I Zoned Out Of This Thread!!!
Thanks, People ?[/QUOTE]
0.1.9 — BETA 5.19