Welcome to the Cumulus Support forum.

Latest Cumulus MX V4 release 4.0.1 (build 4023) - 16 May 2024

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

Auto refresh does't refresh webcam pic?

Other discussion about creating web sites for Cumulus that doesn't have a specific subforum

Moderator: daj

Post Reply
ironeagleuk
Posts: 322
Joined: Wed 02 Dec 2009 8:42 pm
Weather Station: Maplins N96GY (Watson W-8681)
Operating System: Windows 7 Home
Location: Folkestone, Kent, UK
Contact:

Auto refresh does't refresh webcam pic?

Post by ironeagleuk »

Have added a webcam page to my Cumulus site, and as per the subject, I page refreshes, but it doesn't change the webcam pic....the original remains.

I have tried both html code and java script code, but neither help.

Anyone have any clues?

Am no expert with webpages etc...

I used this HTML code:

Code: Select all

<meta http-equiv="refresh" content="60; url=http://homepages.tesco.net/richardaclark/cumulus/webcam.htm">
And tried this javascript code:

Code: Select all

<script language="javascript">
<!--

/*
Auto Refresh Page with Time script
By JavaScript Kit (javascriptkit.com)
Over 200+ free scripts here!
*/

//enter refresh time in "minutes:seconds" Minutes should range from 0 to inifinity. Seconds should range from 0 to 59
var limit="0:30"

if (document.images){
var parselimit=limit.split(":")
parselimit=parselimit[0]*60+parselimit[1]*1
}
function beginrefresh(){
if (!document.images)
return
if (parselimit==1)
window.location.reload()
else{ 
parselimit-=1
curmin=Math.floor(parselimit/60)
cursec=parselimit%60
if (curmin!=0)
curtime=curmin+" minutes and "+cursec+" seconds left until page refresh!"
else
curtime=cursec+" seconds left until page refresh!"
window.status=curtime
setTimeout("beginrefresh()",1000)
}
}

window.onload=beginrefresh
//-->
</script>
The web address is: http://www.ironeagleuk.co.uk/cumulus/webcam.htm


as it's now nighttime, there isn't any visable images to see
Last edited by ironeagleuk on Sun 04 Sep 2011 1:38 pm, edited 1 time in total.
Richard

Image
User avatar
daj
Posts: 2041
Joined: Tue 29 Jul 2008 8:00 pm
Weather Station: WH1081
Operating System: Pi & MX
Location: SW Scotland
Contact:

Re: Auto refresh does't refresh webcam pic?

Post by daj »

It is possibly a caching problem -- The browser does not get the sense that the image has changed so will not reload it from the web server.

Although even on first load on my PC, the webcam time is 4:41 -- it could be cached on a server with your host. If I visit http://homepages.tesco.net/richardaclar ... webcam.jpg I still see a dated image so either you have stopped it uploading; it is not uploading; or it is being cahced by your host

Once we can get the webcam.jpg link updating, there are some HTML tags we can add to help if it is cache problem.


Also, you do not need the url statement in the refresh line, as you a refreshing the current page

So

<meta http-equiv="refresh" content="60; url=http://homepages.tesco.net/richardaclar ... webcam.htm">

becomes

<meta http-equiv="refresh" content="60">
David
kippfordweather.uk
Cumulus MX & Raspberry Pi
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: Auto refresh does't refresh webcam pic?

Post by beteljuice »

Well ........

You have not one but two chunks of Javascript trying to refresh the page, and the meta-refresh tag.

You don't need any of them ! (actually your pic timestamp is still early hours of the morning ?)

Search the web for a code snippet just to refresh the picture - there are plenty of them about.

It will simply involve a timing loop, which will either reload the 'named' image, or replace the contents of the 'named' <div id= ...></div>. It should also add a bit of (unique) nonsense to the end of the picture url eg. "mypicture.jpg" + datestamp to help prevent server / browser caching.
Image
......................Imagine, what you will KNOW tomorrow !
ironeagleuk
Posts: 322
Joined: Wed 02 Dec 2009 8:42 pm
Weather Station: Maplins N96GY (Watson W-8681)
Operating System: Windows 7 Home
Location: Folkestone, Kent, UK
Contact:

Re: Auto refresh does't refresh webcam pic?

Post by ironeagleuk »

Thanks for the replies guys.

I think I have sorted it now with your advice.

I took out the 2 javascript parts, and left the html code in, amended as suggested: <meta http-equiv="refresh" content="60">

I also found some code that says no cache as follows: <meta http-equiv=" pragma" content=" no-cache" >

That seems to have sorted the problem with regard to showing the most current picture.

The original picture you saw was the last one the cam took, as it uses motion to generate the picture.

With regard to the time stamp, I don't think I can change it.....the software I am using which takes the pics puts the time stamps on.
It uses this format: %h:%m:%s %A

Have tried %hh & %hr, but that doesn't change it to 24 hour clock........it does say PM though.

Thanks again for your help....any other suggestions would be gratefully received
Richard

Image
TNETWeather

Re: Auto refresh does't refresh webcam pic?

Post by TNETWeather »

You don't need to play games with cache of the page, normally you can force the loading of an image using the same name by adding a time variable to the end of the image name

Instead of getting the file

Code: Select all

webcam.jpg
You get the file like

Code: Select all

webcam.jpg?t=1263066756
You can add a simple JavaScript function on your page to output the current timestamp and add it to the url and you will be fine.

Not a javascript coder but there are many examples on the net for this.
Post Reply