0

Hello. What is the best method to display a random image?

I have a bunch of banners in a folder. The images are named "banner001" and the numbers ascend from there. These banners will be on the top of my pages. What is the most efficient way to randomly pick from these pictures and display them?

I don't know if PHP is even the right answer. I know I can do it by randomly picking html from a txt file, but I wanted to know if there are better ways. Thanks.

2
Contributors
2
Replies
4
Views
11 Years
Discussion Span
Last Post by stupidfly
0

If I understand you correctly, you just want to randomly display a banner image. The following article explains how to set up a simple PHP script to randomly display banner ads.

Simple PHP Banner Ad Rotator Script

If you just want to diplay images and not a hyperlink, just use the HTML img code in place of 'code for ad 1', etc. In other words, don't include the hyperlink code.

Place the block of PHP code in the script where you want the images to display. Also, make sure that you get the image paths correct. You do not have to use the full image URL if the images reside in your Web site.

Hope this helps. :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.