Page 1 of 1
images..
Posted: Tue May 30, 2006 2:54 pm
by tommy1987
Hi, here is my problem,, I have a directory where all uploaded images go, and basically I want a page which just loops over the dir getting all images from it, and just dumping them on the screen is that poss? if so can anyone give any pointers as to how? thanks very much,,
Posted: Tue May 30, 2006 3:12 pm
by pickle
This should do it (untested)
Code: Select all
$fs_path = '/absolute/path/to/images';
$web_path='/web/accessible/path/to/images';
chdir($fs_path);
$files = glob('*');
foreach($files as $filename)
{
echo "<img src = '$web_path/$filename' />";
}
Posted: Tue May 30, 2006 10:58 pm
by harrisonad
Code: Select all
$fs_path = '/absolute/path/to/images';
$web_path='/web/accessible/path/to/images';
chdir($fs_path);
$files = glob('*');
foreach($files as $filename)
{
if (!in_array($filename,array('.','..'))) { // <-- to exclude unwanted items
echo "<img src = '$web_path/$filename' />";
}
}