Script that scans folders and creates a book for each folder?
<p>I'm a photographer and here's what I'm trying to achieve:
I am trying to display more "books" like these ones one under each-other:
    <a href="http://builtbywill.com/code/booklet/" rel="nofollow">http://builtbywill.com/code/booklet/</a></p>

<p>I can replicate the example given in the link above for ONE Album/book but I have 20+ albums to display in my gallery and I dont want to copy/paste 20+ times the same code and change paths 20+ times etc. So I decided to do something in php:</p>

<p>I have the folders say IMAGES/ALBUMS/ALBUM1 to ALBUM10</p>

<p>I need to scan IMAGES/ALBUM and for each ALBUM1 to ALBUMx folder found display all images like this:
    
    
    </p>

<p>And here is the code I have so far:</p>

<pre><code>function mySlider()
{
        $album = array(
            'Asia i Marcin' =&gt; 'images/albums/asiamarcin/',
            'Aneta i Marcin' =&gt; 'images/albums/anetamercin/',
        );
        $dir = $album['Asia i Marcin'];
        //$dir = 'images/asiamarcin/';
        $scan = scandir($dir);  

        for ($i=0; $i&lt;count($scan); $i++) {  
            if ($scan[$i] != '.' &amp;&amp; $scan[$i] != '..') {  
            echo ' 
                    &lt;div&gt;
                         &lt;img width="450" heigth="385" src="'. $dir . $scan[$i] . '" alt="'. $scan[$i] . '" /&gt; 
                    &lt;/div&gt; 
                ';  
            }    

        }   
}
</code></pre>

<p>it's far from perfect, so far i insert it in my html like this:</p>

<pre><code>&lt;div class="b-load"&gt;
    &lt;?php mySlider(); ?&gt;
&lt;/div&gt;
</code></pre>

<p>And i get this:</p>

<pre><code> &lt;div&gt;
 &lt;img width="450" heigth="385" src="images/albums/asiamarcin/asiamarcin01.jpg" alt="asiamarcin01.jpg" /&gt; 
 &lt;/div&gt; 
 &lt;div&gt;
 &lt;img width="450" heigth="385" src="images/albums/asiamarcin/asiamarcin02.jpg" alt="asiamarcin02.jpg" /&gt; 
 &lt;/div&gt; 
 &lt;div&gt;
 &lt;img width="450" heigth="385" src="images/albums/asiamarcin/asiamarcin03.jpg" alt="asiamarcin03.jpg" /&gt; 
 &lt;/div&gt; 
</code></pre>

<p>Ideally I would call it like this:</p>

<pre><code>&lt;div class="b-load"&gt;
   &lt;?php mySlider('ALBUM1'); ?&gt;
&lt;/div&gt;
....
....
&lt;div class="b-load"&gt;
  &lt;?php mySlider('ALBUM2'); ?&gt;
&lt;/div&gt;
...etc...
</code></pre>

<p>I have no idea how to do this :(
I'm not a programmer but I'd like to learn so I'd appreciate your help.
Thank you,
Alex</p>
