output files from a second directory in same php function
Posted
by Turbodurso
on Stack Overflow
See other posts from Stack Overflow
or by Turbodurso
Published on 2010-03-03T20:43:42Z
Indexed on
2010/05/30
8:02 UTC
Read the original article
Hit count: 199
I have the following code to output images from directory im/, how can I tweak this to also output images from another diectory called out/ (for example)? As to echo another img tag under the current one?
<?php
$imgDir = "im/";
$images = scandir($imgDir);
$ignore = array( ".", ".." );
natsort($images);
foreach($images as $file)
{
if(!in_array($file, $ignore))
{
echo "<div id=\"slideWrapper\">\n";
echo "<img src=\"im/$file\" width=\"1000\" height=\"683\" alt=\"$files\" />\n";
echo "</div>\n";
};
}
?>
© Stack Overflow or respective owner