$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 "
  • "; $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 '
    '; if($counter == $filesPerPage){ echo "
  • "; } } } } }