Forum Moderators: coopster
This is the php code I found on this site but unfortunately the '.' and '..' are still causing problems. What I'd like is for them to not appear at all so the first row is my first file. Any help?
$imgdir = "images/gallery/thumbs/";
echo "<table border='1'>";
$img=opendir($imgdir);
while($imgb=readdir($img))
{
$imgb = str_replace(".","",$imgb);
$imgb = str_replace("..","",$imgb);
$imgb = str_replace("jpg",".jpg",$imgb);
echo "<tr><td>$imgb</td></tr>";
}
closedir($img);
echo "</table>";
dislpays:
. //str_replace removes and leaves as ""
.. //str_replace removes and leaves as ""
041010a.jpg
041010b.jpg
041010c.jpg
041010d.jpg
041010e.jpg
041114a.jpg
etc etc etc...
$imgdir = "images/gallery/thumbs/";
echo "<table border='1'>";
$img=opendir($imgdir);
while($imgb=readdir($img))
{
if ($read!='.' && $read!='..')
{
$imgb = str_replace(".","",$imgb);
$imgb = str_replace("..","",$imgb);
$imgb = str_replace("jpg",".jpg",$imgb);
echo "<tr><td>File: $imgb</td></tr>";
}
}
closedir($img);
echo "</table>";
Still gives me two blank rows:
File:
File:
File: 041010a.jpg
File: 041010b.jpg
File: 041010c.jpg
etc etc etc...