Forums

This topic is locked

display image for certain length of time

Posted 10 Feb 2003 18:06:14
1
has voted
10 Feb 2003 18:06:14 Dave Clarke posted:
Hi

I need to rotate images from my recordset , say every 15 mins.

I have created the recordset and got the first image on the page, now I need to move to the next record (and image) every 20 mins or so.
Any ideas?

Thanks

Dave

ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome

Replies

Replied 10 Feb 2003 18:14:31
10 Feb 2003 18:14:31 Brent Colflesh replied:
Dear Dave,
Have your recordset pull a random image - add a meta-refresh for 15 minutes.

Regards,
Brent

Replied 10 Feb 2003 18:43:50
10 Feb 2003 18:43:50 Dave Clarke replied:
Thanks Brent

That would be fine for longish periods of time, like the 15 mins i mentioned before but what if i wanted to do it every 30 seconds? Can't have the page refreshing itself every 30 secs.
Is there a way to consruct a timer or something?

ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome
Replied 10 Feb 2003 20:17:52
10 Feb 2003 20:17:52 Brent Colflesh replied:
Dear Dave,
You could do it w/Flash, JAVA, or some other dynamic applet...

Alternatively, place your image in a frame or layer and just refresh it's contents.

Regards,
Brent

Replied 10 Feb 2003 21:03:24
10 Feb 2003 21:03:24 johan tessens replied:
Use the meta tag generator extension. You can input the refresh time from 1second to ....... . I think the extension is available from this site. If you can´t find it mail me at and i will send it to you.
Replied 10 Feb 2003 21:28:00
10 Feb 2003 21:28:00 johan tessens replied:
or use <meta http-equiv="refresh" content="30" />
Replied 10 Feb 2003 21:38:34
10 Feb 2003 21:38:34 Dennis van Galen replied:
Dave,

are you using application settings ?
if so you can keep it in memory and when it's time for the next image the rotator should movethe database cursor to the next row in the Dbase.

you can use Datediff with minutes to tell your application when to move to the next record.

You can also cache your query...uh, atleast in coldfusion you can do that <img src=../images/dmxzone/forum/icon_smile_big.gif border=0 align=middle>

with regards,

Dennis van Galen
Webmaster KPN Telecom Holland
Financial & Information Services

Studio MX / CFMX PRO / SQL 2000 / NT4 AND win2kPRO / IIS5
Replied 10 Feb 2003 22:39:31
10 Feb 2003 22:39:31 Dave Clarke replied:
Hi Dennis.

I'm guessing here but I think this is similar to what you had in mind.
I have no idea how to use the Datediff function though, so any help would be gladly received.

&lt;%
rsetPictures.MoveFirst
Do Until rsetReminder.EOF
<b>Datediff code</b>
rsetPictures.MoveNext
Loop
%&gt;

Thanks

Dave

ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome
Replied 10 Feb 2003 22:57:10
10 Feb 2003 22:57:10 Dennis van Galen replied:
Dave,

I am not sure how to translate what i had in mind into asp/vb, but what i meant was the server stores a variable when the first image is shown then using if date() &gt;= DATEADD(mi, 15, SESSION.X) you would catch it and move to the next row.

does that make sense ? in asp that probably ammounts to do for while statements, i never understood those <img src=../images/dmxzone/forum/icon_smile_sad.gif border=0 align=middle>

i first mentioned datediff, which works like if DATEDIFF(mi, SESSION.X, Date()) &gt;= 15 then shownext, again i am lousy at asp <img src=../images/dmxzone/forum/icon_smile_sad.gif border=0 align=middle>

I do hope that i get across what i'm trying to say.

EDIT: bigger or equal then...

with regards,

Dennis van Galen
Webmaster KPN Telecom Holland
Financial & Information Services

Studio MX / CFMX PRO / SQL 2000 / NT4 AND win2kPRO / IIS5

Edited by - djvgalen on 10 Feb 2003 23:04:59
Replied 11 Feb 2003 00:16:38
11 Feb 2003 00:16:38 Dave Clarke replied:
Thanks again Dennis

I've tried a few variations on DateDiff and DateAdd with no success.... but I've been thinking even if I could get this to work surely it would only work when the page gets refreshed and it runs the code again?
I may be talking rubbish but you don't know till you ask <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

Dave

ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome
Replied 11 Feb 2003 00:23:19
11 Feb 2003 00:23:19 Dennis van Galen replied:
hmmm, did i miss something about no page refreshes ?

flash with serverside actionscripts is what you want then, or tons of javascript with iframes...

EDIT: try the MM RIA and RIAdvertising devnets <img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle>

with regards,

Dennis van Galen
Webmaster KPN Telecom Holland
Financial & Information Services

Studio MX / CFMX PRO / SQL 2000 / NT4 AND win2kPRO / IIS5

Edited by - djvgalen on 11 Feb 2003 00:24:57
Replied 11 Feb 2003 00:28:06
11 Feb 2003 00:28:06 Dennis van Galen replied:
come to think of it, you can use clientside vbscript, right ?
but you'd still need a frame or iframe to pull it off.

i am going to check this further tomorrow, should be possible without flash !

Dennis

Edited by - djvgalen on 11 Feb 2003 00:36:40
Replied 11 Feb 2003 01:31:10
11 Feb 2003 01:31:10 Dave Clarke replied:
ooops did i forget to mention .. no page refreshes .. sorry

getting somewhere now

I've used an iFrame with an image taken from a random record in the database and refresh the iframe instead of the page.
Problem now is that the images are a bit big so i need to resize them on the fly just like you can with normal images.
I could make thumbnails and put them in another table but that would mean having to take the database offline whilst the alterations are being done, much rather resize them on the fly.

Dave

ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome
Replied 11 Feb 2003 08:36:17
11 Feb 2003 08:36:17 Dave Thomas replied:
Dunno if this is any help but we can only try <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

www.kaosweaver.com/ExtensionsHelp/randomImages_help.asp?4.1.4

Regards,
Dave

UD4 | Flash 5 | SQL | Access | ASP/VBScript | XP-Pro
Replied 11 Feb 2003 12:22:19
11 Feb 2003 12:22:19 Dennis van Galen replied:
Dave, I found this through google:

&lt;HTML&gt;&lt;!--js v2.12 96.12.06 jhk--&gt;&lt;HEAD&gt;
&lt;!-- Cut-N-Paste JavaScript from ISN Toolbox
Copyright 1996, Infohiway, Inc. Restricted use is hereby
granted (commercial and personal OK) so long as this code
is not *directly* sold and the copyright notice is buried
somewhere deep in your HTML document. A link to our site
www.infohiway.com is always appreciated of course,
but is absolutely and positively not necessary. <img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle> --&gt;
&lt;SCRIPT LANGUAGE="JavaScript"&gt;
&lt;!-- Hide from JavaScript-Impaired Browsers
/* First, if you load fewer or more than 6 sponsors
into your rotator, change the "sponnr" variable
to the actual number of sponsor .gifs you plan to
load. */
number_of_sponsors=6;

var sctr=0;
var halt=0;
var isn=new Array();
for (i=0;i&lt;number_of_sponsors;i++){
isn[i]=new Image();
}

/* The sponsor .gif names are loaded into the isn[x]
sponsor images array. You may load any number of
sponsor images (.gif or .jpg or both) into this
array. They must all be the same size, however.
Substitute your own .gif filenames for the ones
shown here. Note that the first .gif must appear
in the isn[0] array element. */
isn[0].src="g/adobe.gif";
isn[1].src="g/infopcf.gif";
isn[2].src="g/webw.gif";
isn[3].src="g/netsc.gif";
isn[4].src="g/jss.gif";
isn[5].src="g/pentax.gif";

/* Finally, replace the URL's below with those of
your sponsors IN THE SAME ORDER. */
var durl=new Array();
durl[0]="www.adobe.com/aic/";
durl[1]="www.pacificcoast.com/entry.infohiway";
durl[2]="www.infohiway.com/webwalker";
durl[3]="info.netscape.com/sban11_e";
durl[4]="www.infohiway.com/javascript/hts.htm";
durl[5]="www.pentax.com/";

/* This script is set to rotate every 10 seconds.
(5000=5 seconds, so 30000 would equal 30, etc)
You should change the number in the setTimeout()
call below for the number of seconds you wish. */
function rotateIt(){
if (halt!=1){
sctr++;
if (sctr&gt;number_of_sponsors-1){
sctr=0;
}
document.sponsor.src=isn[sctr].src;
setTimeout("rotateIt()",10000);
}
}

/* This code will work just fine with or without
frames. However, if you are in frames and wish
to replicate the TARGET="_top" call to remove
frames, change the location.href call to:
parent.location.href=durl[sctr];
below. */
function doIt(){
halt=1;
location.href=durl[sctr];
}

function dispIt(){
parent.window.status=durl[sctr];
}
// End Hiding --&gt;
&lt;/SCRIPT&gt;
&lt;/HEAD&gt;
&lt;BODY BGCOLOR="white"&gt;

&lt;!-- You may wish to have content here above the rotating
sponsor banner. In the table below, you will need to
insert the filename for the any .gif or .jpg that
you wish displayed on the page. If you are using
different height and width images, don't forget to
change those values, as well. --&gt;

&lt;TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0&gt;
&lt;TR&gt;&lt;TD&gt;&lt;A HREF="npgspo.htm" onClick="doIt();return false"
onMouseover="dispIt();return true;"&gt;
&lt;IMG SRC="g/webw.gif" HEIGHT=72 WIDTH=340 NAME="sponsor"
BORDER=0&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;/TABLE&gt;

&lt;!-- Or, you may wish to have content appear here below
the rotating sponsor banners.

IMPORTANT!!! - This little script below is necessary
right at the bottom of your HTML to begin the sponsor
banner rotation: --&gt;
&lt;SCRIPT LANGUAGE="JavaScript"&gt;
&lt;!-- Hide JavaScript from Java-Impaired Browsers
sctr=0;
rotateIt();
// End Hiding --&gt;
&lt;/SCRIPT&gt;
&lt;/BODY&gt;
&lt;/HTML&gt;

HTH.

with regards,

Dennis van Galen
Webmaster KPN Telecom Holland
Financial & Information Services

Studio MX / CFMX PRO / SQL 2000 / NT4 AND win2kPRO / IIS5
Replied 11 Feb 2003 15:22:11
11 Feb 2003 15:22:11 Dave Clarke replied:
Thanks Dave and Dennis

the script from you Dennis is very similar to the extension from Dave (Ultradav), I'll take a look at both when I get the chance.


Dave

ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome
Replied 11 Feb 2003 15:59:56
11 Feb 2003 15:59:56 Dave Clarke replied:
Just had a quick look and neither the script or the extension allow for getting the path for the image from a database or for different sizes images being resized on the fly.
I'll keep looking <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

Thanks

Dave

ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome
Replied 14 Feb 2003 04:26:24
14 Feb 2003 04:26:24 Dave Thomas replied:
Yeah but the extension allows you to choose a relative path and the images have to be uploaded to a folder anyway.
So why can't you just insert the extension code where you normally would the dynamic image code and call the path that the images are uploaded to. Or have i missed something. lol it is 3.30 am after all <img src=../images/dmxzone/forum/icon_smile_tongue.gif border=0 align=middle>

Regards,
Dave

UD4 | Flash 5 | SQL | Access | ASP/VBScript | XP-Pro
Replied 17 Feb 2003 02:55:09
17 Feb 2003 02:55:09 Dave Clarke replied:
ok I've sorted out the resizing on the fly thingy with this extension...

www.valleywebdesigns.com/vwd_ibH.htm

only problem with it is (and this is not a problem with the extension but with UD4) UD4 only allows you to use a recordset field once on a page because it sets the recordsets cursor type to "Forward Only" by default, so to use this extension you must first alter the recordsets cursor type to "Dynamic", then this extension does exactly what it says on the tin.

So now i have an Iframe on my page which contains a page with a go to random record behaviour on it and this resizing extension, this page then refreshes every six seconds thus displaying a random, resized image on the first page every six seconds.

Dave


ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome

Reply to this topic