Hi;
I'm just trying to get a filtered list of .jpg (or .JPG) filenames. This is all I could come up with. Is there an easier way?
<?php
//filter the pictures based on the whatever value you pass into filter
$FILTER="picturesetname*";
//on a linux server now...so case matters.
$JPGs=glob($FILTER.'JPG');
$jpgs=glob($FILTER.'jpg');
//if I try to feed an empty array (either no .jpg files or no .JPG files, the array_merge() will fail so have to if/elseif/else through it...
if ($jpgs!="" and $JPGs!="") {$filenames = array_merge($jpgs, $JPGs);}
elseif ($jpgs!="") {$filenames = $jpgs;}
elseif ($JPGs!="") {$filenames = $JPGs;}
else {}
//sort the filenames...hopefully I named them in the order I want to show them.
sort($filenames);
//show the pictures in a table
echo "<table>";
foreach ($filenames as $value)
{echo "<tr><td align=center colspan=2><img src=\"$value\" style=\"border: 2px double #F5ECCB; padding: 2\" WIDTH=600></td></tr>"; }
echo "</table><br>";
?>