<div>Hi All</div>
<div>Finally the below code I added to page.tpl.php to show different images at on page refresh.</div>
<div>In IE8 it is working fine. Howevr with firefox the image is not shownup. Any clue ?</div>
<div> </div>
<div>The code is as below.</div>
<div> </div>
<div><font color="#cc0000"> &lt;!--    Starting banner  --&gt;</font></div>
<div><font color="#000099">&lt;?php<br>function endswith($string, $test) <br>{ <br> $strlen1 = strlen($string); <br> $testlen = strlen($test); <br> if($strlen1 &lt; $testlen) <br>  return FALSE;<br> $diff = $strlen1 - $testlen;<br>
 $strend = substr($string, $diff);<br> return ($strend == $test); <br>} <br>$dirimage = realpath(&#39;.\sites\all\themes\myzen\templates\himg&#39;);<br>$directory = opendir($dirimage);<br>$counter = 0;<br>while ( FALSE !== ($file = readdir( $directory )) ) <br>
{<br> if(endswith($file, &quot;jpg&quot;))<br> {<br>  $counter++;<br>  $files[] = $file; <br> }<br>}</font></div>
<div><font color="#000099">$counter--;<br>$which   = rand(0,$counter) ;<br>$imagepath = $dirimage . &quot;\\&quot; . $files[$which];<br>?&gt;<br>&lt;img src=&quot;&lt;?php print $imagepath ?&gt;&quot; /&gt;</font></div>
<div><br><font color="#990000">&lt;!--    Ending banner  --&gt;</font></div>