Hi All,
I have a script for random image loading on refresh page. I need different alt tag on every image but not using iframes.
Can someone help me to figureout this problem. This is the script I have used for images.
<?php
$path = array();
$path[] = “images/dir1/”; // 0
$path[] = “images/dir2/”; // 1
$path[] = “images/dir3/”; // 2
$path[] = “images/dir4/”; // 3
$path[] = “images/dir5/”; // 4
$count = rand(0, 4); // max dir number
$dir = $path[$count];
$arr = array();
$cnt = 1;
foreach (glob($dir.”*.jpg”) as $file) {
$arr[] = $file;
$cnt = ($cnt + 1);
}
$number = rand(1, $cnt);
$content = “<img src=”{$arr[$number]}” alt=”RandomImage.” title=”Random Image” />”.”n”;
echo($content);
?>
Please help me.
Sunil Saini