There are two files with *.php extension that you need to retrieve a random image from Google Images and visually display it. However, you may also need to randomly show an image every few seconds on your main page, and an iframe will do the trick.

You will need a Google Image search file to include in your file. Download the that contains the php file.

Once you downloaded that file, create a new file PHP file called images.php and add the standard HTML tags to it.

*Notice at line 4, the page refreshes every 10 seconds with a refresh meta tag.

What if you don’t want the entire page by itself and want to include it on your main page. It’s best to use an iframe to load your images.php page that auto refreshes every 10 seconds.

And that’s it. Now you have a random image from Google Images that you searched for and displayed on your main page.

About The Author

I write about my life! I would appreciate it if you comment and tell me how life is treating you? :)


  1. Good, I improve to repeat it recursively, sometimes the string retrieves and try to show an image that doesn’t exist or is forbidden hotlinking, so I improve retrieving image size and repeating the function if is empty or zero. Cheers

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">