PHP pagination of 400+ pictures
<p>a have a website with more than 400 pictures in a directory. I'd like to list them by 12 on every page. How can i do that? Here is my actual code:</p>

<pre><code> &lt;!doctype html&gt;
&lt;html lang="hu"&gt;
    &lt;head&gt;
        &lt;title&gt;Amatőr&lt;/title&gt;
        &lt;meta charset="utf-8"/&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;h2&gt;&lt;a href="../php/upload_picture.php" style="font-size:15pt; color:#ff00e8; text-decoration: none;"&gt;Vannak jó képeid? Töltsd fel őket és kikerülhetnek az oldalra!&lt;/a&gt;&lt;/h2&gt;
        &lt;article&gt;
            &lt;header&gt;
                Amatőr Lányok
            &lt;/header&gt;
            &lt;div id="kepek"&gt;
                &lt;?php
                $imgdir = '../img/blog/img/amator/'; //Pick your folder
                $allowed_types = array('png','jpg','jpeg','gif'); //Allowed types of files
                $dimg = opendir($imgdir);//Open directory
                while($imgfile = readdir($dimg))
                {
                  if( in_array(strtolower(substr($imgfile,-3)),$allowed_types) OR
                      in_array(strtolower(substr($imgfile,-4)),$allowed_types) )
                /*If the file is an image add it to the array*/
                  {$a_img[] = $imgfile;}
                }


                 $totimg = count($a_img);  //The total count of all the images
                //Echo out the images and their paths incased in an li.
                 for($x=0; $x &lt; $totimg; $x++){ echo "&lt;a onclick='Lightbox.start(this, false, false, false, false); return false;' rel='lightbox[amator]' href='" . $imgdir . $a_img[$x] . "'&gt;&lt;img class='kep_listaz' width='200px' height='160px' src='" . $imgdir . $a_img[$x] . "' /&gt;&lt;/a&gt;";}
                ?&gt;
            &lt;/div&gt;
        &lt;/article&gt;
    &lt;/body&gt;
&lt;/html&gt;

Thanks!
</code></pre>
