I have the following Random image PHP script, but it is not working.
“images/falehafez” is the directory of my images.
Please help me, and I’m not really a pro on PHP so please don’t use professional language. THANK YOU.
Starts:
<?
// #### RANDOM PIC #########################################
$thumbstring = ”;
$file_dir=”images/falehafez”; // DIRECTORY WITH THE PICS
$f_type=”.jpg”; // FILE EXTENSION YOU WISH TO DISPLAY
$dir=opendir(images/falehafez);
while ($file=readdir($dir))
{
if ($file != “.” && $file != “..”)
{
$extension=substr($file,-3); // THIS DIGIT MUST MATCH THE NUMBER OF CHARACTERS SPECIFIED IN THE FILE EXTENSION ABOVE
if($extension == $f_type)
{
$thumbstring .= “$file|”;
}
}
}
srand((double)microtime()*1000000);
$arry_txt = explode(“|” , $thumbstring);
echo “<img src=””images/falehafez”/”.$arry_txt[rand(0, sizeof($arry_txt) -1)].””>
Ends