HTML - refreshing images...

Author
Discussion

polar_ben

Original Poster:

1,413 posts

260 months

Thursday 10th July 2003
quotequote all
Righto - I'm playing around with some ideas for my website - building a personal bensaunders.com site with some kind of online journal & information on public speaking, etc etc

I've spent a couple of days (& late nights) fiddling in Dreamweaver/Photoshop/notepad & I'm pretty happy with the results (but not happy enough to post a link just yet)

BUT - I'd really like some way of refreshing the image at the top of each page - each time the page is visited - from a random group of say, 10 photos.

A bit like this - www.simiandesign.com/blog-fu/

Can anyone explain in layman's terms how to do it?

Ben

Liszt

4,329 posts

271 months

Thursday 10th July 2003
quotequote all
It is done by using style sheets. Are doing anything with scrits/asp/flash/dhtml or is it just good ol' html?

polar_ben

Original Poster:

1,413 posts

260 months

Thursday 10th July 2003
quotequote all
erm, plain old html but am experimenting with css

ToeKnee

1 posts

250 months

Thursday 10th July 2003
quotequote all
The way I did it on that site was to use ColdFusion to generate a random number, and write than number in at the end of the photos.

All of those top photos are called the same thing. topphoto1.jpg, topphoto2.jpg etc..etc..

You could do the same thing with Javascrpt. Just need to know the total range of the random numbers you'll be generating. If you do it with javascrpt, make sure you add in a generic noscrpt tag that puts in a picture as well, otherwise it won't load it you don't have javascrpt turned on.

tomash

175 posts

281 months

Thursday 10th July 2003
quotequote all
What he's actually doing is using layers to mount the image and making them visible on some random basis. What you could do is something like this assuming 2layers called L1 and L2

{SCRIPT LANGUAGE="JavaScript"}
function LoadHeader()
{
var now = new Date();
var sec = now.getSeconds();
var sw = sec % 2;
switch(sw)
{
case 0:
MM_showHideLayers('L1','','hide','L2','','show');
break;
case 1;
MM_showHideLayers('L1','','show','L2','','hide');
break;
}
}
{/scrpt}

MM_showHideLayers is a Dreamweaver scrpt so you should have that.

Then in the body tag add onLoad="LoadHeader()"
you will have to change { for < and } for > around the scrpt declaration.
To add more layers change the mod factor in the line var sw = sec % 2; from 2 to the number of layers you have.
Then add more case statements to the switch and add the following to MM_showHideLayers for each layer 'LayerName', '', 'show' (or 'hide')

Clear as Mud!

polar_ben

Original Poster:

1,413 posts

260 months

Thursday 10th July 2003
quotequote all
Haha! Tony - thanks for taking the time to reply - Hope you don't mind me picking your site as an example!

I'm truly an amateur at this (see my profile for my, er, day job) but I'm enjoying learning. I have found a php file - http://hiveware.com/imagerotator.php - which looks promising...

Cheers
Ben

fatsteve

1,143 posts

278 months

Thursday 10th July 2003
quotequote all
The other option is the adrotator COM object which you get with IIS. It's quite handy BUT it does require your website to be hosted on W2K server and you'll need to use ASP to code the page.

Steve

Robertuk

591 posts

263 months

Thursday 10th July 2003
quotequote all
for an online journal you probably should look at using a tool like blogger.

This is the net's leading diary/journal tool.

daily updates are a breeze.
You set it up once and then just add content.

checkout www.blogger.com

polar_ben

Original Poster:

1,413 posts

260 months

Thursday 10th July 2003
quotequote all
woohoo! got it working thanks to this excellent bit of code - http://photomatt.net/scrpts/randomimage

Ramesh - I've experimented with Blogger & it seems spot on for what I'm doing Only thing I'm not sure about is uploading images through the blogger interface. I think they've stopped offering Blogger Pro temporarily...

edit to add - I really am turning into a

>> Edited by polar_ben on Thursday 10th July 18:19

Robertuk

591 posts

263 months

Thursday 10th July 2003
quotequote all
Random images .

O.K you could either use a scrpting solution (PHP / ASP) for random images or...

The best method I have found is to use the new features in Flash MX - the downside is it requires browsers to have the Flash Player 6 plug-in
(98% of browsers can view Flash Content - but most are still on Flash 5, which is what I design /code with).


Basically the random player looks in a folder for numbered images (image1.jpg ,image2.jpg.....image10.jp)

then randomly displays them. Whats great is you could have 2 images or 50 ...it doesnt care !

hold on (Ramesh searches google.com )

Right,

you can download seomeone elses player here:

www.stravaiger.com/bothysoft/index/index.php

if you need a bit more help just ask.

Ramesh
:-)

>> Edited by Robertuk on Thursday 10th July 18:30

>> Edited by Robertuk on Thursday 10th July 18:31