The latest version of the Random Image Selector plugin for WordPress is available. This is a relatively minor update which precedes the v2.0 update that I’m hoping to release early in the new year.
This update includes a major function addition (generateRandomImageUrlEnc) which spits out a properly URL-encoded version of the random image’s URL.
There’s also been a full review of the code to ensure that it works as expected with WordPress 2.7, thankfully there was precious little to change.
I’m hoping to get the next major release done just prior to WordCamp Whistler so that I can do a quick talk on image randomness and specifically this plugin.
As always, thank you to everyone who has downloaded the plugin in the past, and to those who continue to comment on the blog. Your suggestions are all valued and I’ll be working some of them into the upcoming 2.0 release.
Photo credit: Darren Hester on Flickr
Tags: 77 Comments
Hi,
Thanks for the plugin. Just FYI, when I installed this update, I got four or so errors that I was able to fix by changing line 198 from this:
$physicalPath = get_option(‘randomimage_path’);
to this:
$physicalPath = ABSPATH . get_option(‘randomimage_path’);
Hope that helps someone…
@BB Thanks for that. Not sure how that was missed, plugin has been patched to v1.5.1
It’s completely broken for me in 2.7, with or without the change on line 198.
My images are replaced with code saying:
Warning: getimagesize() [function.getimagesize]: Read error! in [my domain]/html/wp-content/plugins/random-image-selector/randomImage.php on line 220
Hi, first of all, thanks for the great plugin! I updated to 1.5.1 this morning and it broke the headers I was using. I’m no php expert but looking through the code I noticed that the first line in the generateRandomImgTag function was either missing quotes or had some other character in place of the single quotes.
$physicalPath = ABSPATH . get_option(randomimage_path);
changed to:
$physicalPath = ABSPATH . get_option(‘randomimage_path’);
Also, the link in the plugins page in the admin panel links to a missing page on your blog. It looks like it points to 2007 instead of 2008. Thanks again and looking forward to 2.0!
I just upgraded one of my sites to WordPress 2.7 and I get the following error.
Division by zero in [path for my domain]random-image-selector/randomImage.php on line 232
I have the plugin set to constrain to a specific width (300px).
I am using version 1.5.1
@quartet4 & @Eddie: Thanks to both of you for the feedback, these are the hazards of trying to make changes to plugin code at two in the morning. The testing didn’t get done correctly.
Hopefully there weren’t too many problems for people.
Version 1.5.3 fixes the problem with the code, 1.5.4 also fixes the link in the admin page.
It works! Many thanks, Keith.
Great plugin!
If not already in the pipe, multiple randoms would be great (eg four random pictures in one page/post from separate sources). Thanks
[...] Random Image Selector [...]
[...] Random Image Selector [...]
Thanks for a great WP plugin! Easy to use, adds great aesthetic value to blogs. =)
Great plugin! Since I know very little about php, I have a question for you. Is it possible to have this plugin impose the image on top of a graphic currently in the header area. Plus, I would want the image to show up on the far right hand side of the page. If you look at my website, you will see what I mean.
I agree with some others, the ability to display 2 – 4 images would be a nice feature.
Thanks.
Superb plugin thx for programming it.
I never had any problems with is and I’m using it since 2007.
But, yeah there is always a but…, I have a question. Is there a possibility to link it to the actual theme? I’ve tried it, but apparently I’m too noobish to do it.
e.g. ./wp-content/themes/%actual_theme%/random-image/
Would appreciate your help and/or just a short notice it’s not possible (then I would be sad).
@Goran Thanks for the feedback, I’m running behind on the major v2.0 release but multiple images is something I’m thinking about.
@Rob You can use this to superimpose one image on top of another the same way you can with any other
tag. You may need to review some CSS resources to get you the results you want. http://w3schools.com/ may be a good place to start.
@Alex I’m not 100% sure, but if you’re meaning to link it dynamically to a image in the theme directory it would need a code change. The way that it’s set up now is essentially ‘hard-coded’ to a specific folder.
@Keith
Yes I ment a dinamic link. So I have to find how to change the code… :-/
Thanky you for your answer.
@Alex Yea, there just isn’t a way to do what you’re asking the way it’s been written now. It’s something I can certainly look into in future versions, but for now, that’s how it is.
Any way to make this a recursive search through a directory tree rather than just a single directory, or alternatively, could I generate a list of images and point it to that? Thanks, love it!
Just installed WP & Random image plugin – but i get these error messages – any ideas? Thanks
Warning: opendir(wp-content/randomimage) [function.opendir]: failed to open dir: No such file or directory in /home/kantiang/public_html/WORDPRESS/wp-content/plugins/random-image-selector/randomImage.php on line 200
Warning: readdir(): supplied argument is not a valid Directory resource in /home/kantiang/public_html/WORDPRESS/wp-content/plugins/random-image-selector/randomImage.php on line 202
Warning: getimagesize(wp-content/randomimage/) [function.getimagesize]: failed to open stream: No such file or directory in /home/kantiang/public_html/WORDPRESS/wp-content/plugins/random-image-selector/randomImage.php on line 216
Is there a way I can have the banners have individual links to separate parts of the website (or even an external website)?
Thanks!
Hi Keith, this is a fabulous plugin that worked right out of the box. Thank you.
One question – is it possible to use the plugin multiple times on the same page? I had tried renaming the plugin so I could have 2 random images on one page but then I got a couple of fatal errors so I backed out of that.
Is what I’m looking for possible? Thanks.
Hi Keith,
I wonder if you can help. I have your plugin working fine on several sites and think it’s great – however I’ve just set up a new sit – and get this error message and I cannot see what the problem is…
This is the error message:
Warning: opendir(wp-content/randomimage/) [function.opendir]: failed to open dir: No such file or directory in /home/kantiang/public_html/WORDPRESS/wp-content/plugins/random-image-selector/randomImage.php on line 200
Warning: readdir(): supplied argument is not a valid Directory resource in /home/kantiang/public_html/WORDPRESS/wp-content/plugins/random-image-selector/randomImage.php on line 202
Warning: getimagesize(wp-content/randomimage//) [function.getimagesize]: failed to open stream: No such file or directory in /home/kantiang/public_html/WORDPRESS/wp-content/plugins/random-image-selector/randomImage.php on line 216
Warning: Division by zero in /home/kantiang/public_html/WORDPRESS/wp-content/plugins/random-image-selector/randomImage.php on line 229
I can navigate to the image directory with no problem in my browser so cannot understand why the plugin cannot find the directory
please help if you can!
Futher to other’s comments – functionality that I’d love to see is the ability to insert several random image blocks within a site – with the possibility to to have them point to different directories – so you can theme images on different pages
Thanks!
@steve That’s been an ask others have had as well. Perhaps that feature will appear in a later version.
@Glenn it should be possible to use it multiple times on the same page.
I’ve uploaded the plugin and get the following error
Warning: getimagesize() [function.getimagesize]: Read error! in /nfs/c01/h08/mnt/12472/domains/always4-ever.com/html/wp-content/plugins/randomImage.php on line 216
Please advise.
Hi and thanks for the plugin
Is there a way I can have two random images on one page from two different directories? Like directory “phototop” and directory “photobottom”. On the web site it shows photos from the photo top directory on the top of the page and photos from photo bottom on the bottom…
Thanks,
chlori
Hi Keith!
I’ve been searching all over for this plugin – thanks so much.
I’m fairly new at this, and this seems like it should be very easy, so forgive me if I’m missing the obvious.
How do I make all the rotating images simply link to my home page? I use the rotator for my site logo, and I simply want all the different logo versions to be linkable back to my home page.
Thanks! -Chris
Would like to use this plug-in in my header, but the header image is defined in a CSS doc. Can’t seem to embed the PHP command in the CSS. No image appears although the link in the plug-in preferences is correct.
@Chris You can wrap the PHP call with a regular HTML anchor tag when you place it in your template.
< a href="somepage.html" rel="nofollow">< ?php if (function_exists('generateRandomImgTag')) { generateRandomImgTag(); } ?>< /a>
@iw support for inserting images into a css file will be showing up in an upcoming version. I’ve got a version of it running on this site now. It should be ready by mid-April.
@Keith
Thanks for this great plugin.
One question: I doubled the generateRandomImgTag();
line in my code to generate two random images.
The problem is that sometimes shows the same images. Is there a way to solve this?
@Anne Jan — I’m afraid not at this point. That’s the trouble with randomness. An interesting feature to consider in future though, perhaps I can look at doing a pull of more than one image at a time.
This is very cool – It will pull the images from a directory? Definitely gonna try this out on a template I’m messing with – Thanks!
@ShellMedia Yes. That’s the way it works. The instructions included should explain it well enough.
support for inserting images into a css file will be showing up in an upcoming version. I’ve got a version of it running on this site now. It should be ready by mid-April.” — Cannot wait, this is exactly what I need.
I’m getting the same error messages that scubafish had on January 24. Any ideas on this?
Hear hear to the CSS feature. Being able to use the plug-in for randomizing CSS background images would be killer.
Thank you!
Hi,
Upgrading to 1.5.4 from some long ago version didn’t go so well. There were all sorts of fail to opendir error messages (as indicated in some other comments in this thread.)
I tinkered for a while, and discovered that commenting-out the ABSPATH in line 148 and then dropping the entire absolute pathname into the input box in the settings panel did the trick.
$physicalPath = /* ABSPATH . */ get_option(‘randomimage_path’);
Hope this helps someone.
-cj
Hi Keith,
It works perfect! Thanks for this great simple plugin!
Cheers,
Milena
I can’t seem to get this plugin working. I uploaded and activated it, set the paths and put the code you provided on a test page, but it returns nothing when I view the page.
The test page is at http://endocentric.org/2008/?page_id=25
and the path to the image directory that I want the plugin to pull images from is /www/2008/wp-content/gallery/fotographie/04
I’m perplexed…
Hi Keith,
I was wondering, does this plugin also work for WP 2.8? I don’t seem to get it working, no image shows up, but I’m sure I have got the right settings…
Laura
The plugin does work with 2.8. I haven’t updated the documentation to reflect that yet. We have seen some difficulty with blogs nested in a subdirectory (domain.com/blog) which is something I want to take care of in a future release.
Hi, thanks for a great plugin,
I get some scrollbars when I click on my image when it’s linked. Can I remove the link altogether or get rid of the scrollbars?
Ras.
I’ve double-checked confirmed this is happening in Firefox but not in IE8. It has something to do with the way the browser is handling the iFrame you’re showing the images in. If you increase the size of the iFrame by a couple of pixels top and bottom, the issue will probably go away.
When the image is clicked, Firefox seems to be reading the selection border (that shows up on active content) as a real border and placing the scrollbars accordingly. The same thing happens if you tab through the page, the scrollbar appears whenever the image is selected.
I also forgot to mention that you can of course remove the link as well. It’s not required for the plugin to function.
hi. i am new at using wordpress…plugins…everything. i installed your plugin and edited the required info in the options. now, i just want this to show up on one page (not all of them. so i don’t think i can edit the header.php or maincontent.php files right?…how can i do this? i tried just pasting the code that is provided into upload/insert section of the “edit page” page…but that doesn’t seem quite right and certainly doesn’t work (the code just shows up on the page. not the images!). i am sure i am missing something big here, but i blame it on lack of experience. :-/. does anyone have any ideas how i can get this to show up just on my homepage (a static page…not a blog page). thank you so much!
-colleen
@Colleen There are a couple of options. The first (and somewhat more dangerous) would be to install a plugin that would allow you to embed PHP code in your posts and pages. This solution will work as long as you don’t overdo things…
The second option would be to edit the page template and add a line to detect the page being loaded, if it’s your homepage page then display the random image code, otherwise do nothing.
keith,
Thanks for all of your work this is great plug-in. I was wondering on how version 2 is coming? Also, wanted to suggest a feature which is to have different pools of images for different pages or uses on a single site.
Thanks!
Doug.
Hi there,
I’ve posted this problem a couple of times already but with no ideas/response. It’s really odd as I have your plugin working fine on several other sites and think it’s great – however I’ve just set up a new site – and get this error message – I cannot see what the problem is…
I can navigate to the image directory with no problem in my browser so cannot understand why the plugin cannot find the directory
please help if you can!
Warning: opendir(wp-content/randomimage/) [function.opendir]: failed to open dir: No such file or directory in /home/kantiang/public_html/WORDPRESS/wp-content/plugins/random-image-selector/randomImage.php on line 200
Warning: readdir(): supplied argument is not a valid Directory resource in /home/kantiang/public_html/WORDPRESS/wp-content/plugins/random-image-selector/randomImage.php on line 202
Warning: getimagesize(wp-content/randomimage//) [function.getimagesize]: failed to open stream: No such file or directory in /home/kantiang/public_html/WORDPRESS/wp-content/plugins/random-image-selector/randomImage.php on line 216
Warning: Division by zero in /home/kantiang/public_html/WORDPRESS/wp-content/plugins/random-image-selector/randomImage.php on line 229
Great plugin; working fine in WP 2.7.1. Any plans to be able to have different sets of random pictures; 12 pic randomly on one page and 7 pics on another, for instance?
Best,
Racine