SELECT AN ALBUM $val) { if (chr($i)=='/') { $root_dir = substr($local['path'],1); for ($j=1;$j<$val;$j++) $root_dir='../'.$root_dir; } } if (strpos($root_dir,$local['path'])===0) { $root_dir = "."; } } // scanning directory for folders and check if they contain image files if (!is_dir($root_dir)) { printError("Couldn't find a root directory. Please specify a valid directory in EasyGallery.php."); } $root_handle = opendir($root_dir); while ($dirname = readdir($root_handle)) { $var1 = strcmp($dirname,'.'); $var2 = strcmp($dirname,'..'); $var3 = is_dir($root_dir.'/'.$dirname); if (($var1!=0) && ($var2!=0) && ($var3==1)) { $dir_handle = opendir($root_dir.'/'.$dirname); $postmp = 0; while ($filename = readdir($dir_handle)) { for ($i=0;$i0) { $folders[] = $root_dir.'/'.$dirname; break 2; } } } closedir($dir_handle); } } 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() rsort($folders); // set initial variable $ordner if (!isset($ordner)) $ordner = $folders[0]; // scanning directories for image files if (is_dir($ordner)){ $dir_handle = opendir($ordner); while ($filename = readdir($dir_handle)) { for ($i=0; $i 0)) { $files[] = $filename; } if ($filename=="thumbnails") { $thumbs = 1; } } } sort($files); $size = sizeof($files); closedir($dir_handle); closedir($root_handle); } else { printError("No Folders found. Please copy your image folders to the location specified in the \$root_dir in EasyGallery.php."); } // --end preprocessing ?> \n"; echo "
\n"; echo "\n"; echo "
\n"; echo "
\n"; // --end form // --begin print images echo "
"; $xpos=8; $ypos=6; $count = 0; $newthumbs = false; $divheight = ceil(count($files)/$columns) * ($thumbwidth+6) + 6; echo "
\n"; for ($y=0;$y"; if($slideshow!=1){ echo ""; } else{ echo ""; } echo "\"$files[$count]\"\n"; if ($image[0]==$image[1]){} elseif ($image[0]<$image[1]) $xpos -= intval(($image[1]-$image[0])/2); else $ypos -= intval(($image[0]-$image[1])/2); } else { $modules = get_loaded_extensions(); if(!in_array("gd", $modules)){ 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.
"; $newthumbs = true; } else { printError("Thumbnail creation failed."); } } $count++; if($count%$columns==0) { $ypos += $thumbwidth+6; $xpos = 8; } else { $xpos += $thumbwidth+6; } } if($newthumbs) { echo ""; } echo "
\n"; echo '

EasyGallery

'; // dont even think about removing this link! echo "
\n"; ?>
"; echo "ERROR: $text"; echo ""; 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; } ?>