How to Insert a Random Image
Hi since you're new here, you may want to subscribe to our RSS feed to get convenient updates.. Thanks for visiting!
By Ana Design
This tip on php helps you display a random image on a web page. Images are selected from a folder of your choice.
The php code
<? Php/*
* Name your images a. jpg, b.jpg etc.
* Add this line to your page where you want the images to appear:
<? php include “randomphotos.php”; ?>
*/// Change this to the total number of images in the folder
$total = “15?;
// Change to the type of files to use e.g. .jpg or .gif or .png etc
$file_type = “.gif”;
// Change to the location of the folder containing the images
$image_folder = “photos/random”;
// you do not need to edit below this line
$start = “1”; $random = mt_rand($start, $total);$image_name = $random . $file_type; echo “<img src=\”$image_folder/$image
© 2007 Anadesign.info. All rights reserved. Article Source
Ana Design is a web designer and a search engine analyst and consultant. She keeps up to date on the latest trends in Web Design and SEO. She maintains a blog in English and Romanian language that provides search engine optimization advice along with other interesting articles centered on internet marketing and web design.
Want to increase visibility of your website and demonstrate your own expertise in website design? Find out how to submit a website design tutorial to Ace Design.
Comment on this article/tutorial
You must be logged in to post a comment.












