$thumbsDesignPath = "trabalhos/design/thumbs";
$imagesDesignPath = "trabalhos/design/large";
$file_display = array('jpg', 'jpeg', 'png', 'gif');
if (file_exists($thumbsDesignPath) == false){
echo 'Directory \'', $thumbsDesignPath, '\' not found.';
} else {
if (file_exists($imagesDesignPath) == false){
echo 'Directory \'', $imagesDesignPath, '\' not found.';
} else {
$thumbs_content = scandir($thumbsDesignPath);
$images_content = scandir($imagesDesignPath);
$design_content = $thumbs_content + $images_content;
$counter = 0;
$filesPerPage = 6;
foreach ($design_content as $design_file)
{
$design_file_type = (end(explode('.', $design_file)));
if($design_file !== '.' && $design_file !== '..' && in_array($design_file_type, $file_display) == true){
if($counter == 0)
echo "<li>";
$counter++;
/*$info = pathinfo($file);
$sFile = basename($file,'.'.$info['extension']);
$aFiles = glob($images.$sFile."[0-9]+.[".implode($file_display,"|")."]"); //This array shows all images relative to the thumbnail that you are seeing*/
echo '<div class="portfolio_pic_hold"> <a href="'.$imagesDesignPath. '/' .$design_file.'" rel="lightbox[Design]"> <img src="'.$thumbsDesignPath. '/'.$design_file. '" /> </a> </div>';
if($counter == $filesPerPage){
echo "</li>";
}
}
}
}
}