Advertisement
Guest User

tobik

a guest
Jun 26th, 2009
890
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.07 KB | None | 0 0
  1. <?php
  2. define("ROOT", "img");
  3. $list = Array();
  4.  
  5. foreach (scandir(ROOT) as $gallery) {
  6.     if ($gallery == "." || $gallery == "..") continue;
  7.     $gallery= ROOT."/".$gallery;
  8.     $dir = dir($gallery);
  9.     while ($file = $dir->read()) {
  10.         $path = $gallery."/".$file;
  11.         if ($file == "." || $file == "..") continue;
  12.         if (is_dir($path)) continue;
  13.         $list[$path] = filemtime($path);
  14.     }
  15. }
  16.  
  17. arsort($list);
  18.  
  19. #bez regulernich vyrazu
  20. foreach ($list as $image_path => $time) {
  21.     $tmp = explode("/", $image_path);
  22.     $image_name = array_pop($tmp);
  23.     $thumbnail_path = implode("/", $tmp)."/small/".$image_name;
  24.    
  25.     echo "<a href='$image_path' target='_blank' title='Vytvo&#345;eno ".date("j. n. Y H:i:s", $time)."'><img src='$thumbnail_path'></a>\n";
  26. }
  27.  
  28. #s regulernimi vyrazy
  29. foreach ($list as $image_path => $time) {
  30.     $thumbnail_path = ereg_replace("/([^/])+$", "/small\\0", $image_path);
  31.     echo "<a href='$image_path' target='_blank' title='Vytvo&#345;eno ".date("j. n. Y H:i:s", $time)."'><img src='$thumbnail_path'></a>\n";
  32. }
  33. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement