Page 1 of 1
showing images from a folder
Posted: Mon Apr 20, 2009 5:00 am
by ultimachris
Hi there, i know this is fairly simple, i have a folder where images get uploaded too but i want to create a php fileto show the array of images from this folder, its a simple web folder and all the images are jpg or gif.
Hope you experts could point me in the right direction!!

Re: showing images from a folder
Posted: Fri Apr 24, 2009 9:52 pm
by novice4eva
Code: Select all
$fileNames = array();//this will hold all the file names
if ($handle = opendir($dirPath)) //$dirPath is path of folder where your images are stored
{
while (false !== ($file = readdir($handle)))
{
if ($file != "." && $file != "..") //add conditions for gif/jpg ..
array_push($fileNames,$file));
}
closedir($handle);
}
Re: showing images from a folder
Posted: Fri Apr 24, 2009 10:11 pm
by Benjamin

Moved to PHP - Code