i have tried to display all images from a directory. it works almost for all browser, but does not function in mozilla firefox latest version(14.0.1) .it only display the name of the image.the segment of code is the following.
please help me!!!!!
Code:
<?php
// selecting a photo from folder
$gallary=$dnn['gallary_photo'];
$dir ='../../images'. DIRECTORY_SEPARATOR .$gallary.DIRECTORY_SEPARATOR ;
$imgs = array();
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
if (!is_dir($file) && preg_match("/\.(bmp|jpe?g|gif|png)$/", $file)) {
array_push($imgs, $file);
}
}
closedir($dh);
} else {
die('cannot open ' . $dir);
}
$emgs = glob($dir."*.*");
for ($i=0; $i<count($emgs); $i++)
{
$num = $emgs[$i];
print $num."<br />"; // display full path of the image
echo '<img src="'.$num.'" alt="random image" />'."<br /><br />";
}
?>
Comment