This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. The GNU General Public License is available at: http://www.gnu.org/copyleft/gpl.html Or, write to: Free Software Foundation, Inc, 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA */ function doMain(){ global $pref; # put your website template here ?> <? echo($pref['title']); ?>
$lastmod){ $lastmod = $when; } } # end if ft }# end elseif } #end while closedir($dh); return $lastmod; # sort($imgs); } #end load_dir function getValidExtension($file){ global $pref; foreach($pref['filetypes'] as $pft){ $ext = strtolower(substr($file, - strlen($pft))); if($ext == $pft){ return $ext; } } return ''; } function get_imgs_json(){ global $imgs; $is = Array(); foreach($imgs as $i => $m){ $comma = ', '; # readability $isize = GetImageSize($i); $tsize = scaledim($isize); $is[] = '{ "url": "' . $i .'", ' . '"mtime": ' . $m . $comma . '"width": ' . $isize[0] . $comma . '"height": ' . $isize[1] . $comma . '"twidth": ' . $tsize[0] . $comma . '"theight": ' . $tsize[1] . $comma . '"filesize": ' . filesize($i) . '}'; } $json = '({"data" : [' . implode(",\n",$is) . ']})'; return $json; } function ifmodsince($lastmod){ if ($lastmod) { $cond = isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])? $_SERVER['HTTP_IF_MODIFIED_SINCE'] : 0; if ($cond and $_SERVER['REQUEST_METHOD'] == 'GET' and strtotime($cond) >= $lastmod) { header('HTTP/1.0 304 Not Modified'); exit; } #end if cond header('Last-Modified: ' . date('r',$lastmod)); } #end if lastmod } # end ifmodsince function loadImage($filename){ $ext = getValidExtension($filename); if($ext == "gif"){ return ImageCreateFromGIF($filename); } elseif($ext == "jpg" || $ext == "jpeg"){ return ImageCreateFromJPEG($filename); } elseif($ext == "png") { return ImageCreateFromPNG($filename); } } function doresize($filename){ global $pref; $img = loadImage($filename); $dimensions = GetImageSize($filename); $wide = $dimensions[0]; $high = $dimensions[1]; $dimensions = scaledim($dimensions); $newW = $dimensions[0]; $newH = $dimensions[1]; if($wide < $pref['maxW'] && $wide < $pref['maxH']){ return $img; # already small enough } $newimg = imageCreateTrueColor( $newW, $newH ); ImageCopyResampled($newimg, $img, 0, 0, 0, 0, $newW, $newH ,$wide, $high); ImageDestroy ($img); return $newimg; } function scaledim($dim){ global $pref; $newW = $wide = $dim[0]; $newH = $high = $dim[1]; if($newH < $pref['maxH'] && $newW < $pref['maxW']){ return $dim; } $wrat = $pref['maxW'] / $wide; $hrat = $pref['maxH'] / $high; if($newH > $pref['maxH']){ $newH = $high * $hrat; $newW = $wide * $hrat; } if($newW > $pref['maxW']) { #check both dimensions $newH = $high * $wrat; $newW = $wide * $wrat; } $newH = floor($newH); $newW = floor($newW); $dim[0] = $newW; $dim[1] = $newH; return $dim; } function doNoScript(){ global $pref; ?>

Sorry, this gallery requires JavaScript. However, you may view this image listing:

View directory

" . $pref['title'] . ""; $res .= "

Directory for " . $pref['title'] . "

"; $res .= ""; return $res; } function autoinstall(){ $pjs = fopen("prototype.js","x"); $pjsurl = "http://fennecfoxen.org/misc/prototype.js"; $pjsurl = "http://prototype.conio.net/dist/prototype-1.4.0.js"; if($pjs){ $prototypejs = file_get_contents($pjsurl); if($prototypejs){ fwrite($pjs, $prototypejs); fclose($pjs); } else { echo("

prototype.js not available

"); echo("

Could not auto-install prototype.js - please download it and install manually."); unlink("prototype.js"); } } } ?>