$path=getcwd()."\images";
if(is_dir($path)){
$arrayPhotos=array();
if ($dh = opendir($path)) {
while (($file = readdir($dh)) !== false) {
if($file!=".." && $file!="." && strtolower($file)!="thumbs.db")
if(!in_array($file,$arrayPhotos))
array_push($arrayPhotos,$file);
}
closedir($dh);
}
}
asort($arrayPhotos);
// Include the pagination class
include 'pagination.class.php';
// Create the pagination object
$pagination = new pagination;
// If we have an array with items if (count($arrayPhotos)) { // Parse through the pagination class $imagePages = $pagination->generate($arrayPhotos, 10); // If we have items if (count($imagePages) != 0) { echo "<table>"; // Create the page numbers echo $pageNumbers = '<tr><td colspan=5 class="numbers">'.$pagination->links().'</td></tr>'; // Loop through all the items in the array echo "<tr>"; $counter=0; foreach ($imagePages as $singleImage) { if(($counter++)%5==0) echo "</tr><tr>"; // Show the information about the item echo '<td><img src="images/'.$singleImage.'" border="0" style="padding:5px;" width="150" height="200" /></td>'; } echo "</tr>"; // print out the page numbers beneath the results echo '<tr><td colspan=5 class="numbers">'.$pageNumbers.'</td></tr>'; } }