Andrew2010 Posted November 6, 2010 Share Posted November 6, 2010 I need a php script that loads a random image in a set poistion, on page. Anyone have such a script? Quote Link to comment Share on other sites More sharing options...
Airzooka Posted November 6, 2010 Share Posted November 6, 2010 Wrong forum. How do you want to randomly load the image? If you have your images in the same directory and named like "image_1.jpg", "image_2.jpg", "image_3.jpg", and so on, you could do something like this: <?php // Generate a random number $number = mt_rand(1, 3); // Change the "3" to the number of images available // Print the random image on the page, wherever you want it positioned echo '<img src="image_' . $number . '.jpg" alt="Picture!" />'; ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.