title: PHP Display images in columns
body: <p>I recently had an image gallery displayed nicely in four equally wide boxes, with the images as 100% width, clear both and height auto. This worked pretty well, except I had hundreds of images called on the page. </p>
  
  <p>I am trying to get the same effect, only using a short php script to call the images and display them. </p>
  
  <p><a href="http://kingdomworldbuffet.co.uk/gallery.html" rel="nofollow">Here is a link to the gallery before</a></p>
  
  <p><a href="http://toladverts.co.uk/balloonatics/gallery.php" rel="nofollow">And here is a link to the site which I am trying to achieve the 4 column fetch thing on.</a> </p>
  
  <p>And the php code I currently have</p>
  
  <pre><code>&lt;?php 
      $dir    = 'images/gallery/';
      $files  = scandir($dir);
      $images = array();
  
      foreach($files as $file) 
      {
          if(fnmatch('*.jpg',$file)) 
          {
              $images[] = $file;
          }
      }
  
      foreach($images as $image) 
      {
          echo '&lt;img src="images/gallery/'.$image.'" /&gt;';
      }
  ?&gt;
  </code></pre>