Options to pass to the script: dir, width, random_sort for example thumbs_gallery.php?dir=assorted_cool-2005-06-14&width=80&random_sort=1 THANKS TO This script utilizes php code from resize.txt at http:kentung.f2o.org/scripts/thumbnail/ I'm not certain there isn't redundant code or unused variables in here :) HELPS I only know my homedir on my server because a Movable Type install told me :( but your host can tell you. It may not be necessary to know it though: you might be able to set $homedir and $URLdir the same. Then use this script by doing a php include, and passing the arguments you want when including. BUGS the image-generating backbone code I used creates /thumb subdirectories that I can't remove for some reason (at least on my server) unless I hose the directory above them. Don't know why. Also, once the /thumbs directory has thumbnails in it I don't have an option to overwrite them if you make thumbnails a size you don't want. //----------------------- */ //START OF SCRIPT $homedir = '/home/alexandt/public_html/images_public'; $subdir = $_GET['dir']; $mydir = $homedir . '/' . $subdir; $mydir = dir($mydir); $URLdir = "http://www.alexandtia.com/images_public"; $URLimgdir = $URLdir . '/' . $subdir; $homeimgdir = $homedir . '/' . $subdir; $homethumbsdir = $homeimgdir . '/thumbs'; //thumbnail image width.. if ($_GET['width']) { $width = $_GET['width']; } else { $width = 100; } include("http://www.alexandtia.com/serverapps/resize.txt"); //Read filenames in the directory. $array_files = array(); while(($file = $mydir->read()) !== false) { //Pattern match so that we only put files in the array //if they are .jpg, .gif, or .tif (you can add others to that //pattern match if you want) if (eregi ('.jpg$|.gif$|.tif$' , $file) ) { array_push($array_files, $file); } } //To make the order random if you //want.. to confuse your visitors.. uncomment the following: if ($_GET['random_sort']) { shuffle($array_files); } foreach ($array_files as $key => $value) { //create thumbnail directory if it doesn't exist, //and thumbnail file if it doesn't exist, //and display inline series of thumbnails linking to //larger image files. $filename = $homeimgdir . '/' . $value; $thumb=new thumbnail("$filename"); $thumb->size_width($width); if (file_exists($homethumbsdir)) { //do nothing } else { mkdir($homethumbsdir, 0777); } $thumbfile = $homethumbsdir . '/thumb_' . $value; if (file_exists($thumbfile)) { //do nothing } else { $thumb->save($thumbfile); } $URLimg = $URLimgdir . '/' . $value; $URLthumb = $URLimgdir . '/thumbs/thumb_' . $value; print " "; } ?>