Hope you experts could point me in the right direction!!
showing images from a folder
Moderator: General Moderators
-
ultimachris
- Forum Newbie
- Posts: 1
- Joined: Mon Apr 20, 2009 4:58 am
showing images from a folder
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!!
Hope you experts could point me in the right direction!!
- novice4eva
- Forum Contributor
- Posts: 327
- Joined: Thu Mar 29, 2007 3:48 am
- Location: Nepal
Re: showing images from a folder
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);
}
Last edited by Benjamin on Fri Apr 24, 2009 10:07 pm, edited 1 time in total.
Reason: Changed code type from text to php
Reason: Changed code type from text to php