How do I display all the images in a folder?
-
Say I had a post or page that was called interesting stuff. Is there a way I can display all the images from a folder called interesting stuff? Changing the contents of the folder would change the photos being displayed on the post or page.
I found this searching the web:
<?php
$files = glob(“images/*.*”);
for ($i=1; $i<count($files); $i++)
{
$num = $files[$i];
echo ‘<img src=”‘.$num.'” alt=”random image”>’.” “;
}
?>But I have never been able to get php code to run inside a post or page.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘How do I display all the images in a folder?’ is closed to new replies.