Want some randomness on your website? Try out this PHP image rotator. This script will display a random image every time the user re-loads the page or starts navigating. A very nice effect that can help you make your website a little bit more interactive.
This script can be perfectly used for a banner of header on your website. You can also use this in your signature or avatar on a forum. Additionally, you can rotate HTML and CSS files. Just make sure this script is placed on a PHP server, otherwise it will not work.
Demo
Simply refresh the current page and see the image below changing each time. The image is chosen randomly. You can also visit the demo page for a lightweight demo page.
Installing on your site
To install the script, simply download it and place it in any folder of your server. In the default configuration, all images from the folder where the script is located are used.
Example:
images/header/rotate.php
images/header/abstract.jpg
images/header/bird.jpg
images/header/butterfly.jpg
images/header/happy.jpg
Now direct the source to the PHP file and you're done.
<img src="images/header/rotate.php" alt="Header" width="400" height="100" />
That's it. Now any random image file located in the same directory as the script will be displayed.
Advanced configuration
Change this variable in the script to locate the directory where your images are placed. When the default is selected, the script wil randomly use any image file that is located in the same directory as the script.
In this variable you can set which image types are used. For example, remove all the default $extList values and add a $extList['css'] = 'text/css';. Now a random CSS file be selected. This way, you can play a little bit with your websites CSS, making it fun for the visitor every time he reloads the page. You can actually random any file you want.
Attached files:
Download Source
View Demo
Enjoy and good luck using this script. Where are you going to use it for? Tags: php webdesign image rotate script
Interested in this topic? You might enjoy another article I've written called
Spread the word and submit to:
    
|