Punny Random Image

Here’s a simple but powerful random image or image rotation script. It’s especially useful for image advertisement rotation.

Download: punny_random_image.zip (v1.0)


Check out the demo here: http://www.punny.org/test_images.png

Reload that address a few times and you’ll see it in action.


1. Download and unzip. You’ll find an index.php file.

2. Create a directory on your website. Any directory. Call it anything. I like to add a .png to the end of the directory name for reasons that will become obvious in a moment.

Example: http://www.example.com/path/to/my_directory.png/

3. Upload the index.php file to the directory. Do NOT rename index.php.

Example: my_directory.png/index.php

4. Create a directory called “images” inside the directory.

Example: my_directory.png/images/

5. Add any number of PNG, JPG, or GIF images to the “images” directory.


6. Now simply call the image directory from any to get your random image.

<img src=”http://www.example.com/path/to/my_directory.png/” />

See? It looks like you’re calling a regular PNG image. Fabulous!