Display latest image in directory ending in
<p>I'd like to display the last modified image in a directory that ends in a specific way.</p>

<p>I have it working to display the last file in the directory I only don't know how to go about filtering the result to only display the latest in the directory ending in "wide-block.jpg"</p>

<pre><code>&lt;?php
$base_url = 'images/folio/web-portfolio';
$newest_mtime = 0;
$show_file = 'images/folio/no-image.jpg';
if ($handle = opendir($base_url)) {
while (false !== ($latestFile = readdir($handle))) {
    if (($latestFile != '.') &amp;&amp; ($latestFile != '..') &amp;&amp; ($latestFile != '.htaccess')) {
       $mtime = filemtime("$base_url/$latestFile");
       if ($mtime &gt; $newest_mtime) {
          $newest_mtime = $mtime;
          $show_file = "$base_url/$latestFile";
       }
    }
  }
}
echo '&lt;img src="' .$show_file. '" alt="Latest from the web"&gt;';
?&gt;
</code></pre>

<p>I got that code from somewhere else and realize it won't need the second if statement of != file types listed once my check of display the latest file ending in "wide-block.jpg".</p>
