title: How can I add captions to this auto-create php gallery?
body: <pre><code>&lt;?php        
      /* settings */  
      $image_dir = 'gallery/';  
      $per_column = 3;  
      $count=0;
        if ($handle = opendir($image_dir)) {  
          while (false !== ($file = readdir($handle)))  
          {  
              if ($file != '.' &amp;&amp; $file != '..')  
              {  
                  if(strstr($file,'-thumb'))  
                  {  
                      $files[] = $file;  
                  }  
              }  
          }  
          closedir($handle);  
      }  
      if(count($files))  
      {  
          foreach($files as $file)  
          {   
              $count++;  
              echo '&lt;a class="thumbnail" rel="one-big-group" href="',$image_dir,str_replace('-thumb','',$file),'"&gt;&lt;img src="',$image_dir,$file,'" width="100" height="100" /&gt;&lt;/a&gt;';  
              if($count % $per_column == 0) { echo '&lt;div class="clear"&gt;&lt;/div&gt;'; }  
          }  
      }  
      else  
      {  
          echo '&lt;p&gt;There are no images in this gallery.&lt;/p&gt;';  
      }  
  
  ?&gt;  
  </code></pre>
  
  <p>How can I add captions to each of the images?
  Thank you very much for the answer!</p>