I’ve just put the finishing touches on the latest version of the Random Image Plugin that I originally released in the summer. This plugin will allow you to produce an <IMG> tag containing a randomly selected image from a folder of your choice on any wordpress page (or post if you allow php).
The two biggest features in this version are:
- Automatic discovery of your Wordpress Folder: One of the biggest barriers to entry for the non-technical folks who tried to use this plugin was a lack of knowledge (or access) for finding the physical path to the Wordpress installation. The plugin will now automatically detect and use this path.
CAVEAT: If you currently point your plugin at a folder which is outside of your wordpress installation, you will need to move that folder to use the v1.2.0+ versions of the plugin. - Scaling/Sizing of the Displayed Images: One of the most requested features from the first iteration of the plugin was the ability to resize or scale images to fit in a particular location. With older versions, if you wanted all the images to display at the same size or proportions then you needed to resize them all prior to uploading. Well this is no more! Now you can upload tons of randomly-sized images and the plugin will take care of the dirty work (including the calculation of just how much to scale-to-fit.
I’d like to take the opportunity to thank everyone who has downloaded the plugin, and particularly those who have taken the extra time to send me feedback. As of this release the plugin has been downloaded over 2,400 times which far exceeds anything I thought I would accomplish.
So give this plugin a shot, and let me know if it works out for you!
Tags: Blogging · Development · Downloads · Open Source · Programming · Web 2.0 · Wordpress Plugins93 Comments
[...] December 9, 2007: The Random Image Plugin has been updated! Please see the new post for updates on features, or to [...]
I installed and loved this plugin a week ago, displaying random pictures in my sidebar (no widgets). Today my husband helped me to upgrade WordPress from 2.0.4 to 2.3.1. Now that I’m on the current version, I implemented the built-in sidebar widgets. I’ve verified that the plugin is working. I get random images when I put the code on a different page, but it no longer works in my sidebar. Help!
Hi Laura,
When you activate widgets in Wordpress, everything in your static sidebar is ignored. If you turn off your widgets, the images should return, but you would lose the functionality of any new widgets that you’ve added.
The plugin doesn’t currently have “widget support”. I’m planning to add this feature in the next version, but I haven’t quite figured out when it will be released.
Hi,
Yup. Got that the regular sidebar goes away when widgets are used, and vise-versa. I want to use widgets, but I also want to use your nifty random image plugin.
Have my fingers crossed that you get it figured out soon. I really miss it!
Hey there.
I came across this nifty plugin and am delighted as it’s been a great help on a project I’m doing for a non-profit organisation (the site’s not officially live yet, but you can look at it at http://www.gbv.ie/index.php).
I had one thing I thought I should mention. As I am using strict validation, all the image elements on the website must have an alt attribute.
I have adjusted the latest release of the plugin so that line 225 reads:
echo '';
I’m not sure that there’ll be a better way of getting a readable name in there, but as long as the filename is explanatory, then it should be beneficial.
damn. I never know what word press comments are going to do to code lines…
em – maybe this:
`echo ”;`
or
echo '';
can i put a link to any post with a single image ?
Hello. I am having some trouble getting this plugin to work for me and I am hoping you’ll be able to help.
I have installed and activated the plugin, and put the php code in the sidebar, but nothing appears at all.
I have filled out the options page to the best of my ability. I know I have #2 correct (http://www.MYDOMAIN.org/connect/wp-content/photos), but am not sure how to tell if #1 is right.
My installation of WP is in a folder called “connect” inside the root directory, but the index for it is in the root directory.
This part is automatically on the options page:
/usr/local/psa/home/vhosts/MYDOMAIN.ORG/httpdocs/connect/
And I have tried entering these in the box just to the right:
/wp-content/photos/
wp-content/photos/
I am not getting any error messages. I am using Firefox.
I know this is a long comment but I hope you can help me. Thank you very much!
@Alex: Thanks for the comment and the email, this has been added to the next revision of the plugin.
@John: You can put a link around the entire tag right now, but there isn’t a way to link based on the image that comes up.
@Carla: The second option (wpcontent/photos/) should be working. If you can include a link to your site, I might be able to have a look and see what the path should be.
I gave up and used something else, but I’d still like to figure it out. Website’s very much “under construction.”
[...] Random Image Selector3. [...]
I’m using the 3K2 theme, where the background image in the header is defined in the style.css file. The code is:
#header {
padding: 0;
margin: 0;
position: relative;
height: 200px;
background:url(images/head.jpg) no-repeat #e6f7ff;
}
How can I use this plugin to change the background header image?
Love it! Just got it working on my test site. A great added feature would be if you could match graphics with page and post ID’s – so have 124.jpg load when you’re on a page with that ID. That would be fantastic!
[...] ya est
@Michelle: Thanks for the feedback. I’ll add it to the “list of requested features” for future versions…
I was wondering if it’s possible to put several Random Image generators in 1 site – that each point to different image folders?
Would I need to upload several versions of the plugin or is there another way to do this?
Thanks
nice plugin – thx for the share
I could be very fancy to make it possible that the pictures were could be link to a specific site..
best regard,
Md – http://www.islamdk.dk
Look forward to it. Site is now live and the random images really ‘make it’!
@saffron: currently the plugin reads from one source. You’d need to make copies of it, and change some of the code.
@hizb: currently the plugin doesn’t support linking to specific sites. There has been several requests for this so I may take this on later this year.
Hey K!
Looks like a great plugin you’ve created here! My question is similar to Radiohode’s inquiry. I’d like to use the plugin to generate a random background for my entire frontpage.
I’m calling for my current background in the css right now:
body {
font-size: 62.5%; /* Resets 1em to 10px */
font-family: ‘Lucida Grande’, ‘Verdana’, ‘Arial’, ‘Sans-Serif’;
color: #fff;
text-align: left;
background-color: #000000; /* f26522 – original orange */
background-attachment: fixed;
background-image: url(http://www.hasservision.com/images/sunset_08-10-07.jpg);
background-repeat: no-repeat;
}
Is it possible to but the php code in the css, or do I need to create a separate php file?
Thanks again for your contribution!
-GK Hasser
@Hasser: The because the plugin is applied with a PHP function, it cannot be called from a PHP file. You can rename your .css file to a .php file, and put functions in… but you’ll need to change all the references to the CSS in the rest of the site.
Hi kdmurry,
thank you for your help. Do you have any pointers for how I would change the code, what code I would need to change….where to start….???!
I have tried renaming the plugin slightly & uploading a second copy – but this did not work
Thanks Keith for developing this plugin, it is just what I wanted for my blog. I had some problems with the previous version (I did not have the physical path) but I download v1.2.1 5 minutes ago, and click, click, click and now it is running. Thanks again and happy blogging
Here is something for a wish-list, if you have one, I see several people are after something alike:
To enable RIS to pool from diferent libraries for diferent locations on the website (tipically, topbanner and sidebar banners).
@Roy: I’m glad you like the plugin.
The request for RIS to handle multiple locations isn’t a new one, and it is something I’ve been thinking about. Truth is it would pretty much require a ground-up rewrite and that’s why it hasn’t been done yet.
But it is on the wish list… yes I do keep a list.
[...] Plugin Homepage [...]
Keith, excellent plugin. I’ve been looking for something like this for a long time. I got it working as a sidebar block on Hemingway theme, which is the theme I use on my site.
I was wondering: is there any possibility of making something like a slideshow of images? The plugin changes the image everytime the page is refreshed or reloaded (ctrl+f5 on most browsers, tested on Firefox 2). I was wondering if theres a possibilite of changing the image automatically say, every 5 seconds, or ten seconds. Probably it would require some JS libraries, like Prototype, MooFX… or any other around. Just to make a cool transition effect.
But, is this possible at all without having to rewrite everything ground up? Unfortunately, my programming skills are not up to the task I believe…
Cheers from Buenos Aires!
Sebastián.
great plugin! thanks a lot! you gave me a great help to make my brand new blog charmish
i’ve just edited the img name portion of the php code to insert a fixed copyright statement
I’ve managed to make a slideshow as a block on my Hemingway sidebar. I’d like to make it public, it may help someone, but I don’t have any idea of how to make a WP plugin out of it… I made it out of a simple CSS and JS layout I found here:
http://iamacamera.org/sandbox/photoshuffler/
I just made minor adjustments in order to adapt it for a hemingway block.
Perhaps this could be of some help to see if you could include as an option a slide.
Cheers!
Sebastián
Nice job, Sebastián! Any objections if I were to make a plugin out of this one?
Is there a demo?
Want to see how it crops before installing.
Of course not! I’d be honoured! In fact I posted this because I don’t know how to make a plugin! I’m kinda “learning by doing”, without the learning part LOL!
I think soemething that could be done is provide an interface on the WP admin section to make the necessary modifications to the JS file. Of course, I made everything by hand, and I have no idea how to make a plugin out of it.
By mixing that, and adding the resizing part on your plugin, could make a nice thing I believe.
It will be my pleasure if you can make out of it something useful for other people.
Cheers!
Sebastián
By the way… I didn’t do anything… I just implemented the code in Hemingway, but all the hard work goes to Carl Camera (www.iamacamera.org), his code does everything.
Cheers again! (I have to change the “cheers”, it’s becoming too repetitive hehe)
Sebastián.
@Delete Dmoz: The plugin doesn’t crop or alter the original image at all. It will attempt to scale it if the scaling options are turned on, otherwise it will just place the image without modifying it.
The only demo is at the top of the page.
The plugin runs my image headers for this site.
Great plugin. Worked perfectly the first time in Wordpress v2.3.3.
I modified it by giving it my own title and alt names, other than that, pefect right outta the box!
Hi,
I’ve installed the plugin but, this time around, I can’t get it to work… I’ve checked the absolute path to the specific folder I’m using with a php $_SERVER['SCRIPT_FILENAME'] call from that directory and I’ve checked the URL to the folder by ‘opening’ an image inside from the address bar… The paths I’ve entered are both correct. I even temporarily fully opened the rights on the folder. I’ve also tried to call the function from different parts/pages. All, regretfully, to no avail…
I did get it to work before, for a different site. And I do still would like to use the plugin because I like its simplicity. But this time, using version 1.2.1, I’m hitting a proverbial wall so to say…
Thanks in advance for your reply! Would be great if you could have a look at it…
Here are the details:
Path to the WP installation that was found by the plugin: /home/vhosts/eyes-on-mywork.com/httpdocs/eom/
Added: wp-content/featured/images
URL: http://eyes-on-mywork.com/eom/wp-content/featured/images
Thanks!!!
CID
PS.:
1) The problem seems to be getting an image filename… I suspect. For: the image tag is written to the page but the src is empty…
2) Could there be any other server/rights settings that are preventing the plugin from reading the contents of the folder…? (I personally can’t think of any…)
Hope it helps… Thanks again!
great plugin! it work well also as a background body images, just play with z-index in the style.css and in the Radom Options (point 3) choose “Force a height/with” with the value 100% in the fields Height and With!
thanks!
in future releases it would be very nice features if you integrate the option to create more than one folder and then assign each folder to a category… for example: if i open category 1 the set of random images would be different from category 2 and so and so…
Hi, great plugin.
Just to let you know that as is, the plugin will not validate against the XHTML validator. The reason being : the ALT tag is missing from the IMG selector. Easy to change, but might make a worthwhile addition.
Thanks again
Is there a way to set it so it excludes a particular page? I have just one page on my site that I’d like to always have a certain header image on, and I don’t want this to affect it.
@Drumbo: Thanks for the feedback, I’ll make sure to add that in the next update to make it xhtml compliant.
@Aaron: y default, most people include it in the header, which means it will show up on every page. If you added it to another page or another part of the template then you could more easily exclude it from other pages.
I am really hoping someone can help me. I have never had such a hard time using a plugin.
I have followed what is said to do and nothing.
When I ask where does it go, please do say, oh just throw it in the header.php.
I am not into code but I have installed many things into my blog.
I have installed, activated and setup the folders where the photos are.
no I have this piece of code you list.
where does this “exactly have to go”
screen shots would be great as well.
my email is michaelbcusden@gmail.com
I have tried a few of the random image header plugins and I don’t understand why they are so hard to use.
People seem to be getting it to work and I am getting frustrated.
any help would be great.
Hi cuzzy,
Without knowing some detail about the wordpress theme you’re using it’s difficult to be specific. The reason you’ve had more difficulty with these types of plugins is that unlike most plugins these have to take into account the many different ways that the theme developers may choose to display an image.
In looking at your code I’ve found the following image tag:
<img src=”http://chocolatedogblog.com/wp-content/themes/RockinNewspaper-3Col-1-0/images/photo1.jpg” alt=”The Chocolate Dog Blog” />
If you replace that tag in your header file with the sample code that I’ve included in the documentation this should handle the problem.
I am having a issue with subdirectories….It seems that when there is a subdirectory in a gallery folder..it gives this error: Warning Division by Zero….can you plz fix this problem…its Fixable
@Jack: Can you explain how you’ve got this set up? Is it a gallery folder containing both images and subfolders? or…?
I’m putting a site together at the moment, and was thinking about using this plugin.
When testing it, I found that you still have an alert box set to pop javascript info if ‘Height’ is selected as the scaling attribute. I’m aassuming that wasn’t intential, and figured you’d want to know.
I had situation where I had a small amount of space to put the random image, that was constrained by both width and height, but I didn’t want to just force the dimensions and have the images look off.
I ended up creating a new scaling option, to scale by either width or height, depending on the circumstances (ie. if scaling by height would result in a width greater than that declared, scale by width instead).
It’s not complicated, but I figure it’s a useful feature. Email me if you want and I’ll send it over.
@Paul: Thanks for the heads up. I’ll shoot you a note and get that feature worked into the next version.