Collecting all pictures in folder to display [solved]
Moderator: General Moderators
-
the9ulaire
- Forum Commoner
- Posts: 74
- Joined: Mon Jun 11, 2007 11:31 am
Collecting all pictures in folder to display [solved]
So I have a folder with multiple pictures in it. How can I use php to display each picture in the folder?
Last edited by the9ulaire on Wed Mar 19, 2008 1:01 pm, edited 1 time in total.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Collecting all pictures in folder to display
Code: Select all
$Pictures = glob('/path/to/pictures/*.jpg');
foreach($Pictures as $Pic){
echo 'The Picture name is ' . $Pic . '<br/>';
}-
the9ulaire
- Forum Commoner
- Posts: 74
- Joined: Mon Jun 11, 2007 11:31 am
Re: Collecting all pictures in folder to display
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/>'; }
Re: Collecting all pictures in folder to display
Just a FYI, glob has alot more overhead then say opendir();the9ulaire wrote:Awesome! Thank you so much!
http://www.code2design.com/forums/glob_vs_opendir
http://cboard.cprogramming.com/showthread.php?t=76987