Use techietims solution all the way down, mines terrible
Here you go, explanation below:
PHP Code:
<?php
$imagesNum = 8; //the amount of images.
$random = rand(1,$imagesNum);
$data = array('image','png'); //array('prefix','type')
$imageDisplay = $data[0].$random.chr(46).$data[1];
$imageName = substr($imageDisplay, 0, strpos($imageDisplay,$data[1])-1);
echo "<img src='$imageDisplay' /><br />$imageName";
?>
Ok, starting with the first line:
PHP Code:
$imagesNum = 8; //the amount of images.
This is the amount of images you have in the file
PHP Code:
$random = rand(1,$imagesNum);
Leave this line as it is.
PHP Code:
$data = array('image','png'); //array('prefix','type')
The first section where it says image, is what the prefix is, so image1 to image $imagesNum.
And the second section is the type, so above you said gif, so change it to gif.
And rest:
PHP Code:
$imageDisplay = $data[0].$random.chr(46).$data[1];
$imageName = substr($imageDisplay, 0, strpos($imageDisplay,$data[1])-1);
echo "<img src='$imageDisplay' /><br />$imageName";
Leave it alone. In the image element though, if your using standard HTML, take away the back slash.
I hope this helps.
Bookmarks