Limit Number Of Images Per Page

Hello Everyone
I need Help I have a Gallery And I want to Add Button lead more
I need Limit Number Of Images per Page
I have Images In Directory ,
The Index.php File :

$gallery = new Gallery();
$images = $gallery->getImages();
<!DOCTYPE html>
    <title>Image Gallery</title>
    <link rel="stylesheet" type="text/css" href="css/gallery.css">

    <div class="Container">
        <?php if($images): ?>
        <div class="gallery cf">
            <?php foreach($images as $image): ?>
            <div class="gallery-item">
                <img  src="<?php echo $image['full']; ?>">
        <?php endforeach; ?>

    <?php else:  ?>
        there Are No images.
<?php endif ?>
<span id="loadmore" num_loaded="10">Load More</span>

the Gallery File :

class Gallery{
    public $path;

    public function __construct() {
         $this->path = __DIR__ .'/gallery';

    public function setPath($path){
        if(substr($path, -1) == '/'){
          $this->path = $path;
    private function getDirectory($path){
        return scandir($path);

    public function getImages($extensions = array('jpg','png','gif')){
        $images = $this->getDirectory($this->path);
        foreach ($images as $index => $image) {
            $extension =strtolower(end(explode('.', $image)));    
            if(!in_array($extension, $extensions)){
                $images[$index] = array(
                    "full" => $this->path .'/'.$image,
                    "thumb"=> $this->path .'/thumbs/'.$image
        return (count($images)) ? $images : false;

please Help me

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.