title: Pull all images from a folder and create Bootstrap carousel/slideshow
body: <p>M getting stuck with this code, where i am trying to pull all images inside a folder &amp; put them in list or div, to create Bootstrap Carousel.</p>
  
  <pre><code>  &lt;div id="spa_gallery" class="carousel slide" data-ride="carousel"&gt; 
      &lt;!-- Carousel indicators --&gt;
  
      &lt;!-- Wrapper for carousel items --&gt;
      &lt;div class="carousel-inner"&gt;
  
  
  &lt;?php
  $dirname = "spa_gallery/";
  $images = glob($dirname."*.jpg");
  foreach($images as $image) {
  $imagelist.= '&lt;li class="item"&gt;&lt;a href=""&gt;&lt;img src="'.$image.'" /&gt;&lt;/a&gt;      &lt;/li&gt;';
  }
  ?&gt;
  
  
      &lt;!-- Carousel controls --&gt; 
      &lt;a class="carousel-control left" href="#spa_gallery" data-slide="prev"&gt;        &lt;span class="glyphicon glyphicon-chevron-left"&gt;&lt;/span&gt; &lt;/a&gt; 
  &lt;a class="carousel-control right" href="#spa_gallery" data-slide="next"&gt; &lt;span class="glyphicon glyphicon-chevron-right"&gt;&lt;/span&gt; &lt;/a&gt; 
  &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>where previous code was:</p>
  
  <pre><code>&lt;div class="carousel-inner"&gt;
    &lt;div class="item active"&gt; &lt;img src="spa_gallery/01.jpg"  alt="First Slide"&gt; 
  &lt;/div&gt;
    &lt;div class="item"&gt; &lt;img src="spa_gallery/02.jpg" alt="Second Slide"&gt; &lt;/div&gt;
    &lt;div class="item"&gt; &lt;img src="spa_gallery/03.jpg" alt="Third Slide"&gt; &lt;/div&gt;
    &lt;div class="item"&gt; &lt;img src="spa_gallery/04.jpg" alt="Fourth Slide"&gt; &lt;/div&gt;
    &lt;div class="item"&gt; &lt;img src="spa_gallery/05.jpg" alt="Fifth Slide"&gt; &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>