He cogido este.
[HIGHLIGHT="HTML"]
Código PHP:
Ver original
<?php // Root directory $root_dir = "."; // Thumbnail Columns $columns = 5; // Size of thumbnails in pixel $thumbwidth = 100; // Slideshow 0=no 1=yes $slideshow = 0; ?>
<html>
<head>
<title>EasyGallery</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="author" content="Thomas Holtkötter">
<meta name="keywords" content="EasyGallery, WingNut, projects, freitagmorgen.de, www.freitagmorgen.de">
<style type="text/css">
BODY{margin:0 auto;}
*{margin:0;padding:0;}
.form{font-size:0.9em;margin:0 0 0 8px;}
.thumbnails{background-color:#FFF;border:#FFF 2px solid;}
.error{background-color:#999;width:100%;font-size:1.0em;font-weight:bold;padding:30px 0 30px 20px;}
.link{margin-left:11px;text-decoration:none;color:#666;font-size:0.8em;}
</style>
<script type="text/javascript" src="slimbox/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="slimbox/js/slimbox2.js"></script>
<link rel="stylesheet" href="slimbox/css/slimbox2.css" type="text/css" media="screen" />
</head>
<body>
Código PHP:
Ver original
<?php // --begin preprocessing $phpself = $_SERVER['PHP_SELF']; // filetypes for ($i=0; $i<$k; $i++) { } // extract local image folders { $root_dir = 'http://'.$root_dir; } { { { for ($j=1;$j<$val;$j++) $root_dir='../'.$root_dir; } } { $root_dir = "."; } } // scanning directory for folders and check if they contain image files { printError("Couldn't find a root directory. Please specify a valid directory in EasyGallery.php."); } { if (($var1!=0) && ($var2!=0) && ($var3==1)) { $postmp = 0; { { if ($postmp>0) { $folders[] = $root_dir.'/'.$dirname; break 2; } } } } } if (!$folders) { printError("Searched folders don't contain any image! Please change the \$root_dir."); } // !!! if you don't want your folders in reverse order change rsort() to sort() // set initial variable $ordner $ordner = $folders[0]; // scanning directories for image files { { if (($var1 != 0) && ($var2 != 0) && ($var3 == 1) && ($pos > 0)) { $files[] = $filename; } if ($filename=="thumbnails") { $thumbs = 1; } } } } else { printError("No Folders found. Please copy your image folders to the location specified in the \$root_dir in EasyGallery.php."); } // --end preprocessing ?> <?php // --begin form echo "<div class=\"form\">\n"; echo "<form name=\"fotoalbum\" method=\"post\" action=\"$phpself\">\n"; echo "<select class=\"form\" name=\"ordner\" onchange=\"document.fotoalbum.submit();\">\n"; { if ($ordner == $folder["value"]) { echo "<option selected value=\"$ordner\">"; } else { echo "<option value=\""; echo $folder["value"]; echo "\">"; } $text = $folder["value"]; { } echo $text; echo " </option>\n"; } echo "</select>\n"; echo "</form>\n"; echo "</div>\n"; // --end form // --begin print images echo "<div class=\"form\">"; $xpos=8; $ypos=6; $count = 0; $newthumbs = false; echo "<table height=$divheight width=100% cellspacing=0 cellpadding=0><tr valign=top><td>\n"; { $tn_src = $ordner."/thumbnails/tn_".$files[$count]; { $image[0] -= 8; $image[1] -= 8; if ($image[0]==$image[1]){} echo "<div id=\"livethumbnail\" style=\"left:".$xpos."px; top:".$ypos."px; position:relative; zIndex=1;\">"; if($slideshow!=1){ echo "<a href=\"".$ordner."/".$files[$count]."\" rel=\"lightbox-\"".$ordner.">"; } else{ echo "<a href=\"".$ordner."/".$files[$count]."\" rel=\"lightbox-\"".$ordner.">"; } echo "<img src=\"$tn_src\" class=\"thumbnails\" alt=\"$files[$count]\" style=\"width:$image[0]; height:$image[1]; left:0px; top:0px; position:absolute; zIndex=1;\"></a></div>\n"; if ($image[0]==$image[1]){} } else { printError("Your webserver doesn't provide the use of the GD library, which is required to create thumbnails. Please create and add your thumbnails manually."); } if(createthumb($ordner,$files[$count],$thumbwidth)) { echo "tn_$files[$count] created.<br>"; $newthumbs = true; } else { printError("Thumbnail creation failed."); } } $count++; if($count%$columns==0) { $ypos += $thumbwidth+6; $xpos = 8; } else { $xpos += $thumbwidth+6; } } if($newthumbs) { echo "<script>location.reload()</script>"; } echo "</td></tr></table>\n"; echo '<p><a href=http://www.freitagmorgen.de class="link">EasyGallery</a></p>'; // dont even think about removing this link! echo "</div>\n"; ?>
</body>
[HIGHLIGHT="PHP"]
<?php
function printError($text)
{
echo "<div class=\"error\">";
echo "<span class=\"content\">ERROR: $text</span>";
echo "</div>";
exit();
}
function createthumb($name,$file,$maxsize)
{
$maxsize += 8;
list($width, $height) = getimagesize("$name/$file");
$width = min($width, $height);
$tn = imagecreatetruecolor($maxsize, $maxsize);
$image = imagecreatefromjpeg("$name/$file");
imagecopyresampled($tn, $image, 0, 0, 0, 0, $maxsize, $maxsize, $width, $width);
if(!is_dir("$name/thumbnails"))
{
mkdir ("$name/thumbnails", 0777);
}
imagejpeg($tn, "$name/thumbnails/tn_$file", 90);
return true;
}
?>
<script>
<!--
var zoom = 4;
var speed = 4;
var real = 0;
var intervalIn;
var divs = document.getElementsByTagName('div');
for (var i=0; i<divs.length; i++)
{
if (divs[i].id == 'livethumbnail')
{
var myimg = divs[i].getElementsByTagName('img')[0];
myimg.smallSrc = myimg.getAttribute('src');
myimg.smallWidth = parseInt(myimg.getAttribute('width'));
myimg.smallHeight = parseInt(myimg.getAttribute('height'));
divs[i].onmouseover = scaleIn;
divs[i].onmouseout = scaleOut;
if (!myimg.smallWidth)
{