Collecting all pictures in folder to display [solved]
Posted: Wed Mar 19, 2008 11:29 am
So I have a folder with multiple pictures in it. How can I use php to display each picture in the folder?
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
$Pictures = glob('/path/to/pictures/*.jpg');
foreach($Pictures as $Pic){
echo 'The Picture name is ' . $Pic . '<br/>';
}Awesome! Thank you so much!Zoxive wrote:Simple example.Code: Select all
$Pictures = glob('/path/to/pictures/*.jpg'); foreach($Pictures as $Pic){ echo 'The Picture name is ' . $Pic . '<br/>'; }
Just a FYI, glob has alot more overhead then say opendir();the9ulaire wrote:Awesome! Thank you so much!