RewriteEngine on RewriteRule ^(.*)/$ index.php?path=$1 [QSA] Browse to that folder, and you should be up and running. If you do not have mod_write installed: CHOOSE A NEW PASSWORD by setting $CONF['password'] to some string. This password is used to clear thumbnail files. No big security risk, but someone could stress out your server by continuously deleting your thumbnails. Set $CONF['rewrite'] to FALSE. Create a new folder on your server, and copy index.php - this file - into it. Browse to that folder, and you should be up and running. USING: Upload files and directories via FTP into that folder; Gallery will take care of the rest. Thumbnails are automatically generated for JPEGs, GIFs, PNGs and BMPs, and placed in the thumbnails folder, which is specified below CHANGES: v0.7.1 beta - August 11, 2005 - changed some html, nothing functional. v0.7 beta - August 3, 2005 - now should work on more platforms, due to me no longer half-assedly fetching directory contents with `ls` - added the ability to clear out thumbnail files; added password protection to make sure not just any slap can do it. v0.6 beta - August 3, 2005 - if a newer file is uploaded, overwriting an old version, a new thumbnail is generated. v0.5 beta - August 3, 2005 - pagination error corrected ( would show one less than the correct number of pages, skipping the first one ) v0.4 beta - July 23, 2005 - default directory thumbnail problem fixed when rewrite is off - pagination fixed when rewrite off */ /*** CONFIGURATION ***/ /* file/doc root - DO NOT TOUCH */ //$CONF['root'] = substr($_SERVER["PHP_SELF"],0,strrpos($_SERVER["PHP_SELF"],'/')+1); $CONF['fileroot'] = substr(__FILE__,0,strrpos(__FILE__,'/')+1); $CONF['webroot'] = substr($_SERVER["PHP_SELF"],0,strrpos($_SERVER["PHP_SELF"],'/')+1); /* use mod_rewrite? */ $CONF['rewrite'] = TRUE; /* password for clearing thumbnails */ $CONF['password'] = "randomstring"; // please change this when you install. /* what directory should thumbnails be stored in? */ $CONF['thumbnaildir'] = "@thumbnails"; /* which files / directories to ignore */ /* note - this only applies to the base directory where you have installed the gallery. */ /* if these files/directories are present in any subdirectories, they will be seen. */ $CONF['specialfiles'][] = "index.php"; $CONF['specialfiles'][] = ".htaccess"; $CONF['specialdirs'][] = $CONF['thumbnaildir']; /* display settings */ $CONF['folderCols'] = 5; $CONF['fileCols'] = 5; $CONF['filesPerPage'] = 25; /* thumbnail settings */ $CONF['thumb_width'] = 100; $CONF['thumb_height'] = 100; $CONF['thumb_ext'] = "png"; $CONF['generate_file_thumb'] = true; // true if you want to auto-generate thumbnails for files; false otherwise /* default thumbnail images */ $CONF['default_dir_thumb'] = "iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAMAAABHPGVmAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAMAUExURWJiYvLep9mqH//ywuzWltmvMdvBdenRifLitPLgrObLeubMfntrOtTU1NLS0tDQ0P/97f/94cfHx4WFhf/nnt27Xpt7HKuEEqGhod7BapOTk2dnZ39/f3l5eW1tbd++XYxzJv/1j///mf//nv/jff/shv//rP/xi//6lP/+mP/pg//gev//uv/bdf//xf//0//8lv/Xcffx3v//4e7hu7GHDNaqJuXl5a2treveuP/++ODg4NmsK9myP//+yubBXebJddra2t+/OdCqOOrdt9mmGrq6um9vb//8197e3ubBYLCwsObJd9yxN729vXt3boRwNn9rMtysI8uwYt+5M/XLXP/Zftm5WMjIyOK3NP/83PLZfNq3Tdy4Tb2tfXlsRaiOQeLFb+DMk///9P/yyv/ystOzVMetYf/mkNq2UNjY2OLFVO/p1oZvLP/qonFmRP/+tubISPLlu9KhDv/Ycvnqfv/6qNy+ZubDW2pkUdmqJ/LOXP/+yf/8vfLlvNmzNqampmtra9vb29+/XsTExJ+fn7qNCL6eP///x+a9Pv/adPz5j//64f/mgvLfbP/lf//SbOLYvNe9cdamF9KmGfLZd9arHMzMzPXoxPnTZ//swPLlfYyMjP/mo//8w8+dCfLFUuzAR6J/FvLeqq+ZVeK+Ut+1Q/z049y5R//cg//cduzZn9mzJv/0ody5L+/HUfXqkePJfb6UFf/80ea/R76RDv/9xv/13v//5ubEZ+nHZ//70vLboP/0xf/66//+69nPs//9rObMgP/7zGllXP/jlf/mleLGcOPj4//eePLmv5mZmf//pOvl0oGBgfznj///4//tp7Ozs5h/Mv//1XdqQ///se/erObMdebMTf/yz9bTytmrKdmuLfzwu//yuMvLy9mxO+LEat+xK9m7Y9zCdmljUP/71//miW1nVOa2N+LMid+8N+nSj//9y5N2INasI///vP/+xebDZP/+7I51KL+/v//he6SkpP/982hoaPXqyd3d3ea/RP/xvf///+s7TgIAAAIUSURBVHjaYvhPB8AwasmoJaOWjFoyasmoJaOWjFoyasmoJaOWjFoyasmoJVSwxMjEkraWbJSMOX5o9am02zS0xEheQNDO7lrN7yV8IB+9fhpeLh97gMqWSC4/owQCHizBT7jYOWZEeWwryE5In0hNS4wcDoPtUFLe/Xxe7YbZN53WTLFN5H7bzk9FS0wWH4RYotTt9MG2mft6nZVV8qztRZd/UNESS8YyAwhYx/Xzy/4dF4yBYO4t9gAJKlrismetomJpX+GbaY8EruhDgUjKjasW1LRk5/kQs4c+LBz7BDv0YOAY84qXblS0JOfzLoeeze8+fdRBAhn/6qUjqJmEvbw41dDBi/ub5HipaYm9PacyOuhNFZd1pKYly3wZNdFBf7SYsDU1LbGxuaeBDlSmfpUyp6YlmXf2KqKD71t4JKhadolWMaujg5N/472pa8n8f6roYJXrET+qWuJsdlELHXS5Sj+griWseSrooMTUnZeqlkxiFdFGAdWdTG0Kwp5UtYSN9aguDMxcHznZ9D3Ps18yRMY70ZYsXWkIAqELHxeLK+QzyJ07fUnI8T+VLakIm7DgVdDWRbn5DO7CrW58f2jQkEi6y2QqFvhMWnZOwzde6/8kAiItORvn3ygjZSGUdYKW7S7PlulN5v/JBKMN7lFLRi0ZtWTUklFLRi0ZtWTUklFLRi0ZtWTUklFLBtQSgAADAK60daEvS4VUAAAAAElFTkSuQmCC"; $CONF['default_file_thumb'] = "iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAMAAABHPGVmAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAMAUExURcnk/8Th//f4+bfH35mg0afB5Onr7bW5wcXj/4CHlfz8/cjM0cbJz3qBj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sOHSorY7p23dOqW7OOm66P3Mp87poZ0nvz5IRRn8V0DXtyyMZbjqxomu2LMXXmhZljJo/f0yvg1KbVp7dmX/mD3s7C7ata9QpYXtXmnE8H7jNVL4e9k9DGx1P9mL3Lf0iInONbCOEWdKuKjPcxhMRH9A7xtSX+1zk/xA/xQ/yQqw5BWOSIG2MXJ2KZN7BIzCumEAlLBnJhjRAF87C/gjxXTCEGlmRNotsiCpF1TZSYQwQVq4Sn22oA4cAulWcOERE9ynDUsUTNEXjzinFMsKARw7hI8rjQ8NeJH+IriCRfBYhOa58Ihk8gkkjFEhbmkVI/S9zYTQgvgHaoIjZoOco6aApWdOyWMPIUqKiYnyLWiS7D915CQD3gSVXVZaJiTZY4GSGDo2Bd4FTQeCr5FKUAREAqMZTaFaA2iIY5UYMfrQigwJyKENZEN6EQwotmI1Ekt5ua4dKxImEiKC7Be0uQqmmyKEtEEYmC3KIg8kSgELcsiarZyODowhIHnQwTQ/AeQvue4jKT1KUQXVJMXxh0c9M47SIELCaQBghigjHnfXaBBSrGhudJSAGINqJUiAaYRSGGSfzjNa/Wbnx5yL8vxV0PiM7psuJV9YCDvXUXwhcr7kpficGd2n9NIGWOJYRmD3FdEn4BMYUIZlX+/bbq/gd90BWhbhBJgFLnTEGvLbV5FQseXeQv+b8rtARKEREz+11YF1x/3oZJDwmCwHGCyGG1HhDQbjrHEUxVURRA3hHcAWmmQg+ajN0G4gQdYSgnSYK7XB0gvJuHeQ7qWKAaqLkAAiYAkcccRy9cVLtAeACiimBrHVNYRdQNighSziuwKVaxIgOW02TOhTmXChFHCqQ0qDKS6wVBBjheEigEydDYQaOgAXAi4RD8fh78Bs3Ek4p1hRDEw/MKdmONpyEWQKNE/S8dQRYxeJNoRv0qXjc9Idb+WsVdJrP8E6Qf4tv1uwADANkbT11RKx9/AAAAAElFTkSuQmCC"; /*** FUNCTIONS ***/ /* returns image type for thumbnail generator */ function getMime($ext) { $ext = strtolower($ext); $type = "unknown"; if ($ext == "jpg" || $ext == "jpeg" || $ext == "jpe") $type = "jpeg"; if ($ext == "gif") $type = "gif"; if ($ext == "png") $type = "png"; if ($ext == "bmp") $type = "bmp"; return $type; } /* creates directories recursively */ function RecursiveMkdir($path) { if (!file_exists($path)) { RecursiveMkdir(dirname($path),0777); mkdir($path, 0777); } } /*** STYLE SHEETS ***/ $stylesheet = ' body { font-family: verdana; font-size: 8pt; margin: 0px; padding: 0px; } div.control { width: 200px; float: left; background-color: #F0F0F0; border: 1px solid #C0C0C0; margin: 3px; padding: 5px; } div.contents { width: 700px; border: 1px solid #fff; margin: 3px 3px 3px 216px; padding: 5px; } div.header { margin: 3px auto; text-align: center; font-family: Trebuchet MS; font-size: 36pt; font-weight: bold; } div.copyright { margin: 3px auto; text-align: center; font-family: Trebuchet MS; font-size: 8pt; color: #C0C0C0; } div.copyright a { color: #C0C0C0; } table.directories { margin: 3px auto; background-color: E8E8E8; border: 1px solid #C0C0C0; width: 90%; } table.directories td { padding: 5px; background-color: #E0E0E0; border: 1px solid #C0C0C0; font-size: 10pt; text-align: center; } table.directories td img { border: 1px solid #000; } table.files { margin: 3px auto; width: 90%; } table.files span.goLeft { float: left; } table.files span.goRight { float: right; } table.files span.goCenter { } table.files td.skip { text-align: center; } table.files td { padding: 5px; background-color: #F0F0F0; border: 1px solid #C0C0C0; font-size: 8pt; text-align: center; vertical-align: bottom; } table.files td input.filename { background-color: #F0F0F0; border: 0px; font-size: 8pt; text-align: center; } table.files td img { border: 1px solid #000; } table.files td.message input { background: #fff; border: 1px solid #C0C0C0; margin: 3px; } b.variable { color: #080; } '; if (isset($_REQUEST["thumb_file"])) { /***************************/ /*** THUMBNAIL GENERATOR ***/ /***************************/ // set new $path variable $path = ($_REQUEST["thumb_file"]); // remove first / if present if ($path[0] == "/") { $path = substr($path,1); } // get file's extention $ext = substr($path,strrpos($path,'.')+1); // thumbnail path $thumbfile = $CONF['thumbnaildir'].'/'.$path.'.'.$CONF['thumb_ext']; // check to make sure all directories exist $dirpath = $CONF['fileroot'].$CONF['thumbnaildir'].'/'.substr($path,0,strrpos($path,'/')); if (file_exists($CONF['fileroot'].$thumbfile)) { // thumbnail has already been generated // check thumbnail creation date, and check file modification date $file_modified = filemtime($path); $thumb_modified = filemtime($thumbfile); if ($file_modified <= $thumb_modified) { header("Location: $thumbfile"); die(); } } // generate new thumbnail if (!is_dir($dirpath)) { // if the directory does not already exist RecursiveMkdir($dirpath,0777); } // get file's mime type $type = getMime($ext); // if type isn't an image, forward to 'unknown file type' if ($type != "jpeg" && $type != "png" && $type != "gif") { header("Location: index.php?show_thumb_file"); die(); } // create new image $function = "imagecreatefrom".$type; $image = @$function($path); // if image is broken, show error thumbnail if (!$image) { header("Content-type: image/png"); echo base64_decode($CONF['thumbnail_error']); die(); } // image size $imagex = imagesx($image); $imagey = imagesy($image); // calculate new thumbnail dimensions if ($imagex > $imagey) { // image is wider than tall $newx = 100; $newy = $imagey * 100 / $imagex; } else { // image is taller than wide $newy = 100; $newx = $imagex * 100 / $imagey; } // create thumbnail image $newimage = imagecreatetruecolor($newx, $newy); imagecopyresampled($newimage, $image, 0, 0, 0, 0, $newx, $newy, $imagex, $imagey); // save image in directory $function = "image".$type; $function($newimage,$thumbfile); // making sure you can delete the thumbnail in FTP // $rights = `chmod 777 $thumbfile`; $rights = chmod($thumbfile, 0777); // redirect to thumbnail header("Location: $thumbfile"); } else if (isset($_REQUEST["show_thumb_dir"])) { /***********************************/ /*** DEFAULT DIRECTORY THUMBNAIL ***/ /***********************************/ header("Content-type: image/png"); echo base64_decode($CONF['default_dir_thumb']); die(); } else if (isset($_REQUEST["show_thumb_file"])) { /******************************/ /*** DEFAULT FILE THUMBNAIL ***/ /******************************/ header("Content-type: image/png"); echo base64_decode($CONF['default_file_thumb']); die(); } else if (isset($_REQUEST["clear_all_thumbs"])) { $path = isset($_REQUEST['path'])?$_REQUEST['path']:""; /* start spitting out HTML */ echo "\n".''; echo "\n".''; echo "\n".''; echo "\n".''; echo "\n".''; echo "\n".''; echo "\n".'
Gallery
'; echo "\n".'
'; echo "\n".''; echo "\n".''; echo "\n".''; echo "\n".'
'; if (isset($_REQUEST["password"])) { if ($_REQUEST["password"] == $CONF['password']) { echo "Deleting all thumbnails in "; echo $CONF['fileroot'].$CONF['thumbnaildir'].'/'.$path; if ($fileList = opendir($CONF['fileroot'].$CONF['thumbnaildir'].'/'.$path)) { while (false !== ($file = readdir($fileList))) { if (is_file($CONF['fileroot'].$CONF['thumbnaildir'].'/'.$path.'/'.$file)) { $result = unlink($CONF['fileroot'].$CONF['thumbnaildir'].'/'.$path.'/'.$file); if ($result == false) { echo '
Unable to delete '.$CONF['fileroot'].$CONF['thumbnaildir'].'/'.$path.'/'.$file.'!'; } } } echo '
All thumbnails deleted, unless noted above.'; } else { echo "
Unable to delete thumbnails!"; } } else { echo "\n"."I'm sorry, that password is incorrect."; echo "\n".'
Password: '; echo "\n".'
'; } } else { echo "\n".'To erase all thumbnails from this folder ('.$path.'), enter your password.'; echo "\n".'
Only the thumbnails will be erased, and will automatically be regenerated unless you have set the $CONF[\'generate_file_thumb\'] option to false (currently set as '.(($CONF['generate_file_thumb'])?'true':'false').')'; echo "\n".'
Password:
'; echo "\n".''; } echo "\n".'
'; echo "\n".'continue browsing'; echo "\n".'
'; echo "\n".'
'; echo "\n".''; echo "\n".''; echo "\n".''; } else { /******************/ /*** GALLERY UI ***/ /******************/ $path = (isset($_REQUEST['path'])?$_REQUEST['path']:""); $skip = (isset($_REQUEST["skip"])?$_REQUEST["skip"]:0); $files = array(); $directories = array(); if ($fileList = opendir($CONF['fileroot'].$path)) { while (false !== ($file = readdir($fileList))) { if (is_dir($CONF['fileroot'].$path.'/'.$file) && $file != "." && $file != "..") { $special = false; foreach($CONF['specialdirs'] as $specialFile) { if ($file == $specialFile) { $special = true; } } if ($special == false) { $directories[] = $file; } $special = false; } if (is_file($CONF['fileroot'].$path.'/'.$file)) { $special = false; foreach($CONF['specialfiles'] as $specialFile) { if ($file == $specialFile) { $special = true; } } if ($special == false) { $files[] = $file; } $special = false; } } } else { echo "Couldn't open directory."; } /* start spitting out HTML */ echo "\n".''; echo "\n".''; echo "\n".''; echo "\n".''; echo "\n".''; echo "\n".''; echo "\n".'
Gallery
'; /** show directories **/ echo "\n".''; /* show current position in directory structure */ echo "\n".''; /* show a list of directories */ for($d=0; $d'; } echo "\n".''; if ($d%$CONF['folderCols'] == $CONF['folderCols']-1) { echo ''; } } echo "\n".'
'; echo 'gallery'; $location = explode("/",trim($path)); for($i=0;$i'.$location[$i].''; } echo '
'; if ($CONF['rewrite']) { echo ''; } else { echo ''; } echo ''.$directory.''; echo '
'; echo ''.$directory.''; echo '
'; /** show files **/ echo "\n".''; /* figure out which files to show */ if ($skip > count($files)) { $skip = count($files) - $CONF['filesPerPage']; } if ($skip < 0) { $skip = 0; } $skipto = $skip + $CONF['filesPerPage']; if ($skipto > count($files)) { $skipto = count($files); } /* navigation controls */ echo "\n".''; /* empty dir notice */ if (count($files) == 0) { echo "\n".''; } for($f=$skip, $i=0; $f<$skipto; $f++, $i++) { $file = $files[$f]; /* check if thumbnail exists */ /* if exists, use it */ /* if not, and generate-on-the-fly is enabled, generate */ /* if not, and generate-on-the-fly is disabled, use default */ $thumbnail = $CONF['webroot'].''.$CONF['thumbnaildir'].'/'.substr($file,0,strlen($file)).'.'.$CONF["thumb_ext"]; if (!file_exists($thumbnail)) { if ($CONF['generate_file_thumb']) { $thumbnail = $CONF['webroot'].'index.php?thumb_file='.$path.'/'.$file; } else { $thumbnail = $CONF['webroot']."index.php?show_thumb_file"; } } if ($i%$CONF['fileCols'] == 0) { echo "\n".''; } echo "\n".''; if ($i%$CONF['fileCols'] == $CONF['fileCols']-1) { echo ''; } } echo "\n".''; echo "\n".'
'; if ($skip > 0) { if ($CONF['rewrite']) { echo '<<<'; } else { echo '<<<'; } } else { echo '<<<'; } if ($skipto != count($files)) { if ($CONF['rewrite']) { echo '>>>'; } else { echo '>>>'; } } else { echo '>>>'; } // echo '
'; echo "\n".''; for($i=0,$j=0; $i'.($j+1).' '; } else { echo ''.($j+1).' '; } } echo ''; echo "\n".'
No files in this directory.
'; echo ($CONF['rewrite']?'':''); echo ''.$file.''; echo '
'; echo ''; echo '
'; echo ($CONF['rewrite']?'':'').'view'; echo '
clear thumbnails
'; echo "\n".''; echo "\n".''; echo "\n".''; } ?>