View Full Version : Random Image Display on Page

12-13-2006, 06:04 PM

I've been doing various searches on the site to try and find something in PHP or javascript that would randomly or even sequentially display images from a folder that is part of the website. The image sizes would vary, and I would like it to just display them one at a time with possibly a caption added to certain images.
It can pull the images from a source directory and dump them into an IFrame. I don't care just as long as it is one image at a time of varying sizes. The Iframe could be set to the size of the largest image in the directory then the others could just display in the center. Or maybe there is another option?

Thank you in advance,


12-13-2006, 07:22 PM
Do you want a random image to show up on reload or say every 10 seconds a new image apears?

12-14-2006, 06:17 AM
On reload, but if it is easy and possible the every few seconds thing would be fantastic!

I checked my hosting service and found out that I don't have PHP because I'm hosted on a Windows server. I might not be able to migrate over to Linux with the stuff I'm already using. I was kind of hoping for an image display script that didn't have to have the image file names added to the script, but would just get them from a directory.

12-14-2006, 03:21 PM
Somthing like this ? You can see it at the bottom ofwww.casariegoart.com (http://www.casariegoart.com) (the sponsors)

Place in head:

<script language="JavaScript1.1">
var slidespeed=3000
var slideimages=new Array("IMG.gif","IMG.jpg","IMG.png")
var slidelinks=new Array("http://www.site.com","http://www.site.be","http://www.site.com")
var newwindow=1

var imageholder=new Array()
var ie=document.all
for (i=0;i<slideimages.length;i++){
imageholder[i]=new Image()

function gotoshow(){
if (newwindow)


Place in body:

<a href="javascript:gotoshow()"><img src="FIRSTSHOWNIMG.gif" name="slide" border=0 style="filter:blendTrans(duration=3)"></a>

<script language="JavaScript1.1">
var whichlink=0
var whichimage=0
var blenddelay=(ie)? document.images.slide.filters[0].duration*1000 : 0
function slideit(){
if (!document.images) return
if (ie) document.images.slide.filters[0].apply()
if (ie) document.images.slide.filters[0].play()
whichimage=(whichimage<slideimages.length-1)? whichimage+1 : 0


Got this script from DD.