title: Making file extention as a css class by using glob function
body: <p>My PHP knowledge is kind of limited, and I was trying to search for different PHP/JavaScript solutions, but nothing helped me to make it work, so I'd just try to ask the question directly.</p>
  
  <p>I have the following PHP code that loads all the images from a specific folder on server:</p>
  
  <pre><code>foreach(glob($images_path . '*.*') as $filename){
  echo '&lt;img src="' . $filename . '" class="preview" /&gt;';
  }
  </code></pre>
  
  <p>Now, in order to give different styles to the images, based on their kind, I want to recognize the extension of the file, whether with JavaScript/jQuery or PHP, and to put it as a class (preferably, but could be some other idea)... let's say, after the class "preview" which I already have in the code. It could be similar to the extension, just without the dot, of course; e.g. <em>class="preview png"</em>.</p>
  
  <p>Thank you very much in advance!</p>