Apr 13, 2003 #1 farley99 MIS Joined Feb 12, 2003 Messages 413 Location US I want to read a list of all the images in a directory and display them to the screen dynamically. something like foreach ($file in images directory){ echo "<img src=$file>"; } What is the correct syntax for this?
I want to read a list of all the images in a directory and display them to the screen dynamically. something like foreach ($file in images directory){ echo "<img src=$file>"; } What is the correct syntax for this?
Apr 13, 2003 1 #2 danielhozac Programmer Joined Aug 21, 2001 Messages 2,058 Location SE This is what I use: [tt]$dirHandle = opendir("./images" while ($image = readdir($dirHandle)) { if ($image == '.' || $image == '..') continue; echo '<img src="/images/' . $image . '" alt="' . $image . '" /><br />'; } closedir($dirHandle);[/tt] //Daniel Upvote 0 Downvote
This is what I use: [tt]$dirHandle = opendir("./images" while ($image = readdir($dirHandle)) { if ($image == '.' || $image == '..') continue; echo '<img src="/images/' . $image . '" alt="' . $image . '" /><br />'; } closedir($dirHandle);[/tt] //Daniel