The simplest would be something like this
<?php
function randomImage($numImages = 10)
{
srand( time(NULL));
$rand = rand()%$numImages;
$ranImage = '<div class="thumb">
<a href="image'.$rand.'.html">
<img src="images/image'.$rand.'_thumb.gif" alt="Image'.$rand.'" />
<span><img src="images/pre_image01.gif" alt="Image01" />
<img src="images/pre_image'.$rand.'.gif" alt="Image'.$rand.'" />
<em>Image'.$rand.'</em>
</span>
</a>
</div>
';
$echo $ranImage;
}
?>
Then wherever you wanted the image to display you would just do <?php randomImage(10); ?> . Given that you have 10 images that is. Also note that there is most likely a way to format a number to have the leading zeroes but I can't think of it off the top of my head.
ShawnCplus
Code Monkey
1,583 posts since Apr 2005
Reputation Points: 526
Solved Threads: 268
whoops, delete line 9, that was a little booboo
ShawnCplus
Code Monkey
1,583 posts since Apr 2005
Reputation Points: 526
Solved Threads: 268