hitchhiker Posted September 22, 2006 Share Posted September 22, 2006 This PHP solution works and you can easily modify it to suit. Create a folder in the website directory call 'images' and put your images in there. create a folder in the website directory called 'random'. In that folder create 4 html files caled '1.html', '2.html', etc. in each of the html files put this code in: (for each one amend the image name, obviously) <? $x = 1; $random = array( 'image_1.jpg', 'image_2.jpg', 'image_3.jpg', 'image_4.jpg', ); shuffle($random); while($x <= 1){ $x++; echo "<img src='images/", $random[$x] , "' width='[image width]' height='[image height]' alt='[alt text here]'>"; } ?> (also adjust the stuff in the square brackets) (If you want it to output twice or more, change the $x value) Now put this code in to your web page at the first location (page must have .php ext): <?php include("random/1.html"); ?> Then this at the second: <?php include("random/2.html"); ?> etc. The output will be: "<img src='images/[random image]' width='150' height='150' alt='text'> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.