hello, great plugin. only one of very few that work well.
can anyone help with this problem?
i have a stack with with “hot random image inside”
its set to STRECH which it does (w100% h:auto)
it loads ok both on pc and mobile (on mobile its the full image)
the only issue is on pc, because of the stretch it will overshoot the height to outside of the container of the stack box, overlapping other elements.
is there anyway to have it stretch behind or inside? (out of sight) like a cut or crop?
initially i used the stock random header in 2010 theme, but in 2024 theme no such thing?
what i do like in 2024 is loading a background image in for example a ROW which is responsive and contained, but no option to have random images?
any advice would be great. thanks
My images are stored in a hierarchical folder structure. There is a separate directory for each year and each month (e.g. wp-content/uploads/2024/09).
Is there a way to specify a directory of a higher hierarchy level (e.g. wp-content/uploads/2024/) and then display the images in the directories below (wp-content/uploads/2024/01 … wp-content/uploads/2024/08)?
Recommend you change hot_random_image.php code block for file types, to include webp files.
function randomimage_select_image( $path, $link, $width, $height, $alt ) {
$images1 = glob($path.'/*.jpg');
$images2 = glob($path.'/*.png');
$images3 = glob($path.'/*.gif');
$images4 = glob($path.'/*.jpeg');
$images5 = glob($path.'/*.svg');
$images6 = glob($path.'/*.JPG');
$images7 = glob($path.'/*.PNG');
$images8 = glob($path.'/*.GIF');
$images9 = glob($path.'/*.JPEG');
$images10 = glob($path.'/*.SVG');
$images11 = glob($path.'/*.webp'); // Add this line
$images12 = glob($path.'/*.WEBP'); // Add this line
$images = array();
if(!empty($images1))
$images = array_merge($images,$images1);
if(!empty($images2))
$images = array_merge($images,$images2);
if(!empty($images3))
$images = array_merge($images,$images3);
if(!empty($images4))
$images = array_merge($images,$images4);
if(!empty($images5))
$images = array_merge($images,$images5);
if(!empty($images6))
$images = array_merge($images,$images6);
if(!empty($images7))
$images = array_merge($images,$images7);
if(!empty($images8))
$images = array_merge($images,$images8);
if(!empty($images9))
$images = array_merge($images,$images9);
if(!empty($images10))
$images = array_merge($images,$images10);
if(!empty($images11)) // Add this block
$images = array_merge($images,$images11);
if(!empty($images12)) // Add this block
$images = array_merge($images,$images12);
$html = '';
// clean all thumbnails
$pattern = '/^.+?\d{1,4}x\d{1,4}.+$/';
foreach ($images as $key => $value) {
// Check if the value matches the pattern
if (preg_match($pattern, $value)) {
// If it matches, unset the element from the array
unset($images[$key]);
}
}
// remove empty elements from the array
$images = array_values($images);
// randomly select an image
$ind = wp_rand(1,count($images));
if (isset($images[$ind - 1])) {
$image = $images[$ind - 1];
} else {
$image = false;
}
if($image){
// get image caption and alt (if image is registered in Media)
$image_id = attachment_url_to_postid( esc_url(get_site_url().'/'.$image) );
$image_caption = '';
$image_alt = $alt;
if($image_id) {
$image_caption = wp_get_attachment_caption( $image_id );
$image_alt = get_post_meta($image_id, '_wp_attachment_image_alt', TRUE);
}
$html .= '<figure class="wp-block-image">';
if($link){
$html .= '<a href="'.esc_attr($link).'">';
}
$html .= '<img class="hot-random-image" style="width:'.esc_attr($width).'; height:'.esc_attr($height).';" src="'.esc_url(get_site_url().'/'.$image).'" alt="'.esc_attr($image_alt).'" />';
if($link){
$html .= '</a>';
}
if ($image_caption) {
$html .= '<figcaption>'.$image_caption.'</figcaption>';
}
$html .= '</figure>';
}
if (!$path) {
return '<img class="hot-random-image" style="width:'.esc_attr($width).'; height:'.esc_attr($height).';" src="'.get_site_url().'/wp-content/plugins/hot-random-image/images/hot_random_image.png" alt="'.esc_attr($alt).'" />';
}
return $html;
}
]]>
I love the plugin, by the way.
I was wondering if there are any plans to give the block the same functionality (particularly with giving specific images specific links) as the widget variant.
]]>The Hot Random Image plugin does exactly what we want it to, but seems to perform best in Chrome, patchily in Edge, and doesn’t seem to work in Safari at all. Has anyone else experienced this or similar?
]]>A bit concerned to see the following message.
This plugin has been closed as of 7 March 2024 and is not available for download. This closure is temporary, pending a full review.
Can you give some detail about what is happening and whether the plugin will reopen soon.
]]>Hi there,
It is impossible to get the plugin to work on a site where WordPress is it own directory. Like domain.xx/cms/
When I added cms/ in front of the path (cms/wp-content/uploads/randoms) in the code it was added twice:
cms/cms/wp-content/uploads/randoms/ventoux-rose.jpg so no image could be shown. (just displayed the text ‘random image’)
Without the cms/ nothing would show at all.
Sometimes the image load properly but sometimes it scales up or freeze (I am using gifs). Is it possible the images are trying to load when the page isn’t ready yet and it causes this problem ? If so is there a way to use some kind of “$(document).ready()” option ?
]]>Is it possible to add a caption underneath the image?
]]>I’m getting this on my site: Undefined array key 0 in C:\Users\…\wp-content\plugins\hot-random-image\hot_random_image.php on line 84
Any ideas?
I’m interested in this plugin as I’m redesigning this site https://wdcga.org – the banner image on the home page I want to use again and need the caption displayed. Does this plugin allow the caption to be shown using the caption I have entered on the image details?
]]>I have maybe 200 images. I want to show 10 of them randomly on my webpage. Here’s what I have done.
I divide the 200 images into ten folders.
I install Hot Random Image plugin 10 times. Each plugin fetches an image from a specific folder. Thats how I avoid showing the same pic several times.
The problem is that HRI sometimes don’t show a specific image.
If I update the page sometimes it will show the image.
Error msg: “The “hot-random_image” block was affected by errors and may not function properly. Check the developer tools for more details.”
Where is the “developer tools”?
Am I doing something wrong?
Merry Christmas!
Hi all,
I’m prepared to replace Cimy Header Image Rotator, running on Twenty-Eleven Theme, with Hot Random Image.
Now I have installed Hot Random Image and deactivated Cimy Header Image Rotator.
I found all old images of Cimy Header Image Rotator on cPanel of the hosting company
File path:
/public_html/hongkong/wp-content/Cimy_Header_Images/0/feature-colonial-flag_1200_288.jpg
File path:
/public_html/hongkong/wp-content/Cimy_Header_Images/0/hongkong_banner01_1200_288.jpg
File path:
/public_html/hongkong/wp-content/Cimy_Header_Images/0/hongkong_banner04_asis_world_city_1200_288.jpg
etc.
Please advise the steps adding the old images to Hot Random Image
Thanks in advance.
Regards
]]>The images aren’t responsive on mobile. How can I fix this?
]]>I’d love to see a feature for changing the alignments of the images. Currently, I’m “dirty fixing” it with CSS and the post id… But that is anything but mobile proof ??
]]>Hi,
I think there is no option to load another image after a user specified time i.e. 10 seconds. I would appreciate to have such an option to use Hot Randow Image also as a slideshow.
Regards
Bernhard
We are happily using this great plugin. However, the random selection includes the root folder. This results in a broken image as this is not an image file.
]]>Can the image link be set to open the link in a new tab?
]]>Hello,
is it possible to link the images to the WordPress image permalink if I use the Shortcode?
Thank you!
Hello,
the Page Builder ThriveArchitect from ThriveTheme don’t work with Curley brackets {}. They only work with normal brackets [].
I think many Page builders don’t work with Curley brackets.
Is there a way to change it?
Best regards,
Sebastian
The plugin seems to include the thumbnails when circulating the image and not just the full size image. Is it possible to exclude the thumbnails?
]]>DOESN’T WORK: I HAVE PICTURES ON https://tedytok.com/wp-content/uploads/
and added the shortcode:
{randomimage}https://tedytok.com/wp-content/uploads/ ,100%,auto,Random image,{/randomimage}
but it doesn’t show anything
]]>I set width and height to “auto”, but still cannot fix the problem. Sometimes it is okay, but then it stretches the image or only shows part of the image. All the images I have are in the same size, so I also tried to set the size the same as the image size. Still not working.
]]>The randomiser works to some extent, but instead of randomising the image upon refreshing the page, instead it appears to select an image for every individual page, and will only change the image when I go on a different page. Is it possible to set it up in such a way that it will give a new image every time I refresh the homepage, where I have the widget placed?
]]>I’ve just installed Hot Random Image to replace the previous plugin that stopped working. The previous plugin changed images while the same page was loaded but (so far) I’ve only been able to get this plugin to change images when a page is loaded. Have I missed a setting somewhere that determines how often the images change?
Thanks for your assistance with this!
]]>Hello,
First of all amazing plugin! Great work!
I am trying to figure out how to add a different link to each image that is displayed. I have ready a few topics on this however it still doesnt make sense to me and i cant get it to work.
I understand something needs to be added to the specific image box but i dont know how to.
Please can you be specific as to what to put, maybe giving an exact example of how it would be done for a few images would be great.
Thanks
]]>I like to display 3 images (randomized) within 1 row.
For the moment in every place the same image shows up.
Is it possible to show different images the same time ?
Hi
I previously asked about opening the link in a new tab. The suggested solution in that topic now no longer works. It looks like it was and will get overwritten every time the plugin is updated.
I have now tried to reinstate this solution, but the second part of that proposed solution is no longer part of the code.
Anyway, I would like to establish the best way to open the image links in a new tab and make them nofollow.
I assume, if the solution is once again editing the plugin (I’d have to turn off auto-updates), both features will be applied to the same part of the code as they would be in a standard href link!?!
Ideally, these features could be controlled by tick boxes in the widget options.
Thanks
Stefan
I have the widget on a page using another plugin (shortcode any widget). This is so I can have the image on a page, instead of a normal widget area.
The image is always to the left.
Is there any way to center the image?
Hi everyone.
I was using the plugin and it working perfectly until I needed to change my url.
I changed my root url from https://bnu.tv/wordpress to https://bnu.tv but the files still on /wordpress (I did changed .htaccess and the file index.php to root) and when I did it stoped working the plugin.
Someone know what can had happened?
Thanks so much.
]]>