Random Img Displayer
Donate!
If you find this useful please consider a donation… Clicking the button donates just (AUD) $1.00!
RndImgDisplayer WordPress plugin by Jason Oakley
I wanted to have random images display on the front page of my website, but could not find a plugin for WordPress which automatically created tags for me: alt, height, width. So, I wrote it myself.
To use: Unzip the zip file into a directory on your PC and upload the whole folder to the wp “plugins” directory. No need to edit anything.
Go into your WP admin plugin page and activate the plugin. You will have to size your images yourself. I keep them all the same size to keep it consistent, but RndImgDisplayer will do the size tags automatically regardless.
Create a subdirectory under the rndimgdisplayer plugin folder called “randomimages”. (Sorry. Winzip and *nix zip will not zip up empty directories).
Drop the files you wish to display into this directory.
Add the following code to your template (I use it in my sidebar).
<?PHP displayrndimg(); ?>
If you have any problems with it, turn on debugging and it will output some helpful data for you:
<?PHP displayrndimg(1); ?>
If you want to turn on alt text displayed under the image:
<?PHP displayrndimg(2); ?>
If you wish to turn on image borders use the optional border variable:
<?PHP displayrndimg(0,1); ?>
You can combine both if you wish:
<?PHP displayrndimg(2,1); ?>
I’ve now added a CSS tag for this plugin. You can use it similar to this in your Stylesheet:
/* RndImgDisplayer */
#rndimgdisplayer { background: #000000; color: #ffffff; font-weight: normal; }
Download: RndImgDisplayer1_2.zip You can see the plugin in operation on the front page of my blog.
This plugin is now on the WordPress plugins site with it’s own page.
Update: v1.1: Fix for img src url bug found by James Gemmill. Update: v1.2: Added optional text below image for Jo & Vinnie. Added optional border around image for Jo. Added CSS elements for formatting.