A Better Mouse-Trap
Note: See also the article on doing this in Rails.
It is the Narrator’s pleasure to announce the publication of his latest article, entitled Random Image Rotation. It is one of the features in the premier issue of the newly redesigned A List Apart magazine.
The article details the long-awaited new version of the Image Rotator, an easy-to-use PHP script to display random images on a website. The update is, as usual, a ground-up rewrite of the original version, with many improvements including:
- Easier to specify/change the rotation-folder
- Easier to specify/change supported image types
- Better in-script instructions and info
- More error checking (thanks, Milo)
- Cleaner code (albeit more PHP-specific)
- Better/faster random number generation and file-type parsing
- Added a feature where the image to display can be specified
- Added a cool feature where, if an error occurs (such as no images being found in the specified folder) and you’re lucky enough to have the GD libraries compiled into PHP on your webserver, the script will generate a replacement “error image” on the fly
<liSignificant speed improvements
Just a day in the life at Hivelogic Heavy Industries.