Refreshing Images

Brooke's picture

She has: 681 posts

Joined: Feb 1999

This might not be the right spot - but I will put this here anyway. I have a client who wants a different image to appear on his home page each time you come to it. The first time you visit it's image 1, the second time it's image 2, the third time it's image 3, and then the fourth time it repeats the cycle and you see image 1 again.

Make sense? How do I do this?

Thanks everyone.

Brooke

detox's picture

They have: 571 posts

Joined: Feb 2001

you can do this a couple of ways, is the site simply a static html site? or is it asp etc?

Brooke's picture

She has: 681 posts

Joined: Feb 1999

Sorry it has taken me so long to reply...it's a static html site.

Brooke

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

You could set a cookie in JavaScript to ensure that if person A sees image 1 today, he sees image 2 tomorrow.

But it would be easier to use a random script in either JavaScript or CGI (probably JavaScript) that instead of doing it in order, would simply pick one of four and show that and pick one of four on refresh and show that.

Smiling Suzanne

Brooke's picture

She has: 681 posts

Joined: Feb 1999

So I want to do a random script in javascript - how do I do that?

Brooke

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

For the short answer, you might want to search for free JavaScripts that do just that.

If you want to write it yourself, you will want to create an array of images. Then you would write a small script that randomly chooses one of the images. Then you would write another small script that would write the image into place...

document.write('

Brooke's picture

She has: 681 posts

Joined: Feb 1999

I went to: http://www.worldwidemart.com/scripts/
And downloaded the random image scripts. Do you think that will be good for what I am looking for?

TIA!

Brooke

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

It's a CGI script.

You will have to make sure that this will work on your server.

Suzanne

Brooke's picture

She has: 681 posts

Joined: Feb 1999

Thanks you guys. I will give this a try and let you know how it goes.

Brooke

Brooke's picture

She has: 681 posts

Joined: Feb 1999

Okay - you can see this at cataluna.com/clients/sallberg

The rotating images are supposed to be on the right in that big empty space. But as you can see they are not working. Any ideas? Can you see anything that I might be doing wrong?

Brooke

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

I'm pretty sure you haven't read the instructions properly, since "http://www..ser.ver/cgi-bin/rand_image.pl" isn't a valid url.

www..ser.ver should be your server url. In this case www.cataluna.com.

Read the readme.txt file VERY CAREFULLY and make all the changes properly and you should be fine!

Smiling Suzanne

Brooke's picture

She has: 681 posts

Joined: Feb 1999

At first I did have the ser.ver as cataluna.com - but it didn't work so I tried that too. I have it back now and it still isn't working.

Any ideas...

Brooke

PS - I already contacted the creator of the script and I have not heard back yet.

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Did you upload the CGI script in ASCII mode?

Did you CHMOD the CGI script properly?

Are all the images in the right location? Are they listed properly in the script?

You *must* have the correct URL in the IMG SRC attribute. So make sure that it's _not_ www.ser.ver.

S

Brooke's picture

She has: 681 posts

Joined: Feb 1999

Well I wanted to thank all of you for taking the time to respond to my question. I didn't have any luck so I went another route. I have dreamweaver ultra dev 4.0 so I just installed a random image extension. That worked great! You can see it at cataluna.com/clients/sallberg

Thanks everyone!

Brooke

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.