I'm Trying to add paginate so once a total of about 12 images display then can click next to display the next 12 images and so on, without reloading the page if possible. Here is the code im using to display the images
<?php
// open this directory
$myDirectory = opendir("upimg");
$myDir = opendir("thimg");
// get each entry
while($entryName = readdir($myDirectory)) {
$dirArray[] = $entryName;
}
// close directory
closedir($myDirectory);
// count elements in array
$indexCount = count($dirArray);
?>
<?php
// loop through the array of files and print them all in a list
echo "<ul class=\"portfolio clearfix\">" ;
for($index=0; $index < $indexCount; $index++) {
$extension = substr($dirArray[$index], -3);
if ($extension == 'jpg'){ // list only jpgs
echo "\n<li class=\"box\"><a href=\"upimg/" . $dirArray[$index] . "\" class=\"magnifier\" ><img src=\"thimg/" . $dirArray[$index] . "\" ></a></li>";
}
}
echo "</ul>";
?>
Any help is greatly appreciated thanks