Advertisement
Sparkster

Untitled

Jul 18th, 2013
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.76 KB | None | 0 0
  1. <?
  2.     $imagetypes = array("image/jpeg");
  3.  
  4.     function getImages($folder) {
  5.             $images = array();
  6.             $directory = dir($folder);
  7.             while(($entry = $directory->read()) !== false) {
  8.                     if($entry == '.' || $entry == '..' || !strstr($entry, '.')) {
  9.                             continue;
  10.                     }
  11.                     $images[] = $entry;
  12.             }
  13.             return $images;
  14.     }
  15.    
  16.     $path = "tattoos";
  17.     $docroot = "$path";
  18.  
  19.     $images = getImages($path);
  20.     foreach($images as $image) {
  21.         echo "<a href='{$path}/{$image}'>";
  22.         $filename = explode('.', $image);
  23.         echo "<img class='photo' src='{$path}/{$filename[0]}th.{$filename[1]}'>";
  24.         echo "</a>\n";    }
  25.  
  26. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement