Author Topic: Update img without iFrame  (Read 4504 times)

0 Members and 1 Guest are viewing this topic.

jwyman

  • Guest
Update img without iFrame
« on: December 16, 2008, 03:36:49 PM »
Hey All,
  I would like to update a jpg image based on a timer/refresh without having to use an iFrame.... Any suggestions?

Jim

Offline tbweather

  • Contributor
  • ***
  • Posts: 100
    • Tawas Bay Michigan Weather
Re: Update img without iFrame
« Reply #1 on: December 16, 2008, 04:32:33 PM »
I used to use a short JavaScript to accomplish this on an old webcam page I had. Go here for an explanation and sample of the script if you want to do it that way. http://developers.webcamworld.com/template5_cd.html

Offline mmorris

  • Forecaster
  • *****
  • Posts: 766
  • Hope your day is full of sunshine
    • Weather and Racin
Re: Update img without iFrame
« Reply #2 on: December 16, 2008, 06:26:19 PM »
See if you can find
Dr Tim West
www.meteorologica.co.uk

He does the Weatherflash program and see if he is still offering a program called The JpegRefresh applet He made that program many many year ago and I still run it on my web site to update my jpg's .  Hope that is still the right web address I don't know his email but I think I still see him answering question on this board. ( well I just look and couldn't find Tim West name in the member log so I guess he never came here from the old ambient forum. To bad he was a lot of help with his weatherflash program ).
« Last Edit: December 16, 2008, 06:48:21 PM by mmorris »
>>Miles<<  By from Portage Lakes, OH.
Been using VWS since 1996 Ver# 14.01P43
Wireless Vantage Pro2Plus Serial Data Logger, Anemo Tran Kit
Win XP, Firefox, WXSIM, Cumulus, NexStorm, Yawcam, VVP, BadBlue Web server, Quake Catcher Net
Follow me on twitter
Vietnam era Veteran USAF bb loader
Quadruple Bypass survivor

Offline kray1000

  • Purveyor of wry
  • Forecaster
  • *****
  • Posts: 1336
    • http://www.roanokevalleyweather.com
Re: Update img without iFrame
« Reply #3 on: December 16, 2008, 06:50:03 PM »
Here's the link...

Follow the instructions in the "readme" file included in the zip.
http://www.meteorologica.co.uk/downloads/CamStream.zip

You can also use ajax to refresh an image.

Offline mmorris

  • Forecaster
  • *****
  • Posts: 766
  • Hope your day is full of sunshine
    • Weather and Racin
Re: Update img without iFrame
« Reply #4 on: December 16, 2008, 06:54:41 PM »
Thanks saved me a trip I was just on my way to see if I could find a link. I my self I'm using an earlier ver..



Here's the link...

Follow the instructions in the "readme" file included in the zip.
http://www.meteorologica.co.uk/downloads/CamStream.zip

You can also use ajax to refresh an image.
>>Miles<<  By from Portage Lakes, OH.
Been using VWS since 1996 Ver# 14.01P43
Wireless Vantage Pro2Plus Serial Data Logger, Anemo Tran Kit
Win XP, Firefox, WXSIM, Cumulus, NexStorm, Yawcam, VVP, BadBlue Web server, Quake Catcher Net
Follow me on twitter
Vietnam era Veteran USAF bb loader
Quadruple Bypass survivor

Offline mmorris

  • Forecaster
  • *****
  • Posts: 766
  • Hope your day is full of sunshine
    • Weather and Racin
Re: Update img without iFrame
« Reply #5 on: December 16, 2008, 07:18:07 PM »
Ok I just put in the zip file that I use from the download location that you had and my old program seem to be there also here link

http://www.meteorologica.co.uk/downloads/JpegRefresh.zip
>>Miles<<  By from Portage Lakes, OH.
Been using VWS since 1996 Ver# 14.01P43
Wireless Vantage Pro2Plus Serial Data Logger, Anemo Tran Kit
Win XP, Firefox, WXSIM, Cumulus, NexStorm, Yawcam, VVP, BadBlue Web server, Quake Catcher Net
Follow me on twitter
Vietnam era Veteran USAF bb loader
Quadruple Bypass survivor

Offline up10ad N9RJH

  • USA Weather Finder
  • WxElement panel
  • Forecaster
  • *****
  • Posts: 578
  • Station will be back up someday...
    • Forecaster without a site
Re: Update img without iFrame
« Reply #6 on: December 16, 2008, 09:25:48 PM »
This may be a duplicate of suggestions by others, but here is how I do it on my cam pages.  Example pages are here and here (daytime only)

1.  The following is the code on the actual page, placed where you want the pic to appear:

Code: [Select]
<form name="webCam" action="#"><img onload="startClock()" src="new.gif"> Image below will refresh every 5 seconds for two minutes - Auto-refresh in: <input type="text" name="timer" size="2"> seconds.
<img src="/toshibafixed/toshibafixed.jpg" name="webCamImage" alt="Refreshes every 5 seconds..." title="Refreshes every 5 seconds..." width="640" height="480" border="0">
</form>

Replace the img src with the path and name of your image, also update the size.  Note that it must be the same as the var camImage in the .js file below.

2.  The page has a script reference at the beginning:
Code: [Select]
<script type="text/javascript" src="camcountertoshiba.js"></script>
You can name the .js file anything you want, but it must match the name of the file below

3.  The javascript file on disk is named camcountertoshiba.js and is a simple text file:

Code: [Select]
var camImage = 'toshibafixed/toshibafixed.jpg';
var refreshIntervalSeconds = 5;
var secondsLeft = refreshIntervalSeconds;
var reloadCount = 24;

function startCount() {
  if (reloadCount < 1) {
     document.webCam.timer.value = "-----";
    return;
  } else {
      startClock();
      }
}


function startClock() {
  if (secondsLeft > 0) {
    if (secondsLeft < 10) {
      document.webCam.timer.value = '0' + secondsLeft;
    } else {
      document.webCam.timer.value = secondsLeft;
    }
    secondsLeft = secondsLeft - 1
    timerID = setTimeout('startClock()', 1000);
  } else {
  date = new Date();
  imageNumber = date.getTime();
  document.webCamImage.src = camImage + '?' + imageNumber;
  secondsLeft = refreshIntervalSeconds;
  reloadCount = reloadCount - 1;
  startCount();
  }
}

The variables in the above are pretty apparent. 

  • var refreshIntervalSeconds = 5;  HOW LONG BETWEEN RELOADS
  • var reloadCount = 24;  HOW MANY TIMES IT SHOULD RELOAD.  24 RELOADS WITH 5 SECONDS BETWEEN = 2 MIN

If you need help, jus let me know and I'll try.
« Last Edit: February 22, 2009, 11:29:09 AM by k6dyc »
Rick (N9RJH)
Have you joined USAWeatherFinder.com yet?

jwyman

  • Guest
Re: Update img without iFrame
« Reply #7 on: December 17, 2008, 08:38:10 AM »
thanks! I have it running now but have a question about the new.gif src in the form line... Should this be change also?

Offline up10ad N9RJH

  • USA Weather Finder
  • WxElement panel
  • Forecaster
  • *****
  • Posts: 578
  • Station will be back up someday...
    • Forecaster without a site
Re: Update img without iFrame
« Reply #8 on: December 17, 2008, 08:56:30 AM »
NEW.GIF is just a small pic on my page that indicates the feature is new.  Here is the new.gif file I use, it isn't needed for the form actually.    You can download it by right-click and save as, or you can just remove the reference.
Rick (N9RJH)
Have you joined USAWeatherFinder.com yet?

jwyman

  • Guest
Re: Update img without iFrame
« Reply #9 on: December 17, 2008, 09:00:47 AM »
If I remove the refenece then the onload for the StartClock is missing.... Can I start the StartClock another way?

Offline up10ad N9RJH

  • USA Weather Finder
  • WxElement panel
  • Forecaster
  • *****
  • Posts: 578
  • Station will be back up someday...
    • Forecaster without a site
Re: Update img without iFrame
« Reply #10 on: December 17, 2008, 09:12:52 AM »
Sorry, you are correct, something needs to be there to reference.  If you don't want the new image, you could just use/create a 1 pixel gif in a color to match your background so it would appear invisible.  Or you could use any other image, but there has to be something there the way it is written.  I'm sure there is a way around it to reference in the form, but I am not smart enough to do it ;) 
Rick (N9RJH)
Have you joined USAWeatherFinder.com yet?

Offline racenet

  • Forecaster
  • *****
  • Posts: 1306
    • NH Weather Data
Re: Update img without iFrame
« Reply #11 on: December 17, 2008, 11:12:17 AM »
( well I just look and couldn't find Tim West name in the member log so I guess he never came here from the old ambient forum. To bad he was a lot of help with his weatherflash program ).

He is here, just using a different handle. But, isn't really offering support here. You must email him for support.



Bob


www.theamericanflagstore.com - The American Flag Store



www.nhweatherdata.com - NH Weather Data

jwyman

  • Guest
Re: Update img without iFrame
« Reply #12 on: December 17, 2008, 11:13:30 AM »
Thanks! I got it working by doing an onload on the <body> tag. image is updating correctly just the way I wanted! Thanks so much!  =D&gt; =D&gt; =D&gt; =D&gt;

Jim

blackjack52

  • Guest
Re: Update img without iFrame
« Reply #13 on: December 18, 2008, 09:10:35 AM »
Ok I just put in the zip file that I use from the download location that you had and my old program seem to be there also here link

http://www.meteorologica.co.uk/downloads/JpegRefresh.zip

Thanks for the heads up on this one.  But I'm scratching my head.  Any help would be much appreciated.

I am currently testing it on my broadcast jpg but it will only update it I open a new window and access an other website.  If I leave the window open by itself it will not update automatically.  This only happens and IE7. Maybe a cache problem?  Firefox updates OK.
http://www.knology.net/~blackjack52/JpegRefresh.htm

Offline mmorris

  • Forecaster
  • *****
  • Posts: 766
  • Hope your day is full of sunshine
    • Weather and Racin
Re: Update img without iFrame
« Reply #14 on: December 18, 2008, 09:45:01 AM »
Well IE cashes the web pages so here how to fix that. Here a link to my instructions http://milesg.dyndns.tv/web%20serving/to_make_page_refresh.htm
Your link to your broadcast page works fine on my machines.

Ok I just put in the zip file that I use from the download location that you had and my old program seem to be there also here link

http://www.meteorologica.co.uk/downloads/JpegRefresh.zip

Thanks for the heads up on this one.  But I'm scratching my head.  Any help would be much appreciated.

I am currently testing it on my broadcast jpg but it will only update it I open a new window and access an other website.  If I leave the window open by itself it will not update automatically.  This only happens and IE7. Maybe a cache problem?  Firefox updates OK.
http://www.knology.net/~blackjack52/JpegRefresh.htm

>>Miles<<  By from Portage Lakes, OH.
Been using VWS since 1996 Ver# 14.01P43
Wireless Vantage Pro2Plus Serial Data Logger, Anemo Tran Kit
Win XP, Firefox, WXSIM, Cumulus, NexStorm, Yawcam, VVP, BadBlue Web server, Quake Catcher Net
Follow me on twitter
Vietnam era Veteran USAF bb loader
Quadruple Bypass survivor

blackjack52

  • Guest
Re: Update img without iFrame
« Reply #15 on: December 18, 2008, 10:13:30 AM »
That did it.  Thank you very much!

 

anything