1. $thumbsDesignPath = "trabalhos/design/thumbs";
  2. $imagesDesignPath = "trabalhos/design/large";
  3. $file_display = array('jpg', 'jpeg', 'png', 'gif');
  4.  
  5. if (file_exists($thumbsDesignPath) == false){
  6.     echo 'Directory \'', $thumbsDesignPath, '\' not found.';
  7. } else {
  8.     if (file_exists($imagesDesignPath) == false){
  9.     echo 'Directory \'', $imagesDesignPath, '\' not found.';
  10.     } else {
  11.         $thumbs_content = scandir($thumbsDesignPath);
  12.         $images_content = scandir($imagesDesignPath);
  13.         $design_content = $thumbs_content + $images_content;
  14.         $counter = 0;
  15.         $filesPerPage = 6;
  16.                 foreach ($design_content as $design_file)
  17.                 {
  18.                 $design_file_type = (end(explode('.', $design_file)));
  19.                     if($design_file !== '.' && $design_file !== '..' && in_array($design_file_type, $file_display) == true){
  20.                                 if($counter == 0)
  21.                                     echo "<li>";
  22.                                     $counter++;
  23.                                     /*$info = pathinfo($file);
  24.                                     $sFile =  basename($file,'.'.$info['extension']);
  25.                                    
  26.                                     $aFiles = glob($images.$sFile."[0-9]+.[".implode($file_display,"|")."]"); //This array shows all images relative to the thumbnail that you are seeing*/
  27.                                     echo '<div class="portfolio_pic_hold"> <a href="'.$imagesDesignPath. '/' .$design_file.'" rel="lightbox[Design]"> <img src="'.$thumbsDesignPath. '/'.$design_file. '" /> </a> </div>';
  28.                                    
  29.                                     if($counter == $filesPerPage){
  30.                                     echo "</li>";
  31.                                     }
  32.                         }
  33.                 }
  34.         }
  35.  
  36.     }