Please read the posts in the Announcements section about the current status of Cumulus development now that I have retired

Please read this post before posting

Latest Cumulus release v1.9.4 (build 1099) - Nov 28 2014
Latest Cumulus MX release - v3.0.0 build 3043 Jan 20 2017. See this post for download

webcam

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

Moderators: daj, TNETWeather

dazza1223
Posts: 172
Joined: Sun Jan 25, 2015 8:41 pm
Weather Station: davis vantage vue
Operating System: raspberry pi 3
Location: worthing
Contact:

webcam

Postby dazza1223 » Sun Apr 02, 2017 10:58 pm

hi all i have my webcam setup but erver so offen the webpage refresh and it ony got half as it will be in the middle of writing the jpg to a directory when the ajax refresh occurs, so instead of displaying a broken image

so here the js
file var t_webcam = 1 // interval in seconds
image_webcam = "/images/webcam.jpg" //name of the image
function Start_webcam() {
tmp_webcam = new Date();
tmp_webcam = "?"+tmp_webcam.getTime()
document.images["refreshwebcam"].src = image_webcam+tmp_webcam
setTimeout("Start_webcam()", t_webcam*1000)
}
Start_webcam();

User avatar
vaggos
Posts: 232
Joined: Sat Feb 06, 2010 7:00 pm
Weather Station: PROWEATHER STATION 1080
Operating System: XP SP3, win7, Win10
Location: Acharnes Athens Greece
Contact:

Re: webcam

Postby vaggos » Tue Apr 04, 2017 5:28 am

Try this:

Code: Select all

<IMG name="webcam"
            width="240" height="177" alt="Please wait the image will appear soon"
            src="../images/webcam.jpg"
            border="0"></A>
<SCRIPT language="JavaScript" type="text/javascript">
interval = 60000;
imgsrc = "../images/webcam.jpg"
tmp = new Date();
tmp = "?" + tmp.getTime();
document.images["webcam"].src = imgsrc + tmp;
setTimeout("Refresh()", interval);
}
Refresh();


Change the dimensions and the time of refresh (in msec)
Image
Acharnes Athens Greece Meteo station
http://www.meteoacharnes.gr
https://weather.meteoacharnes.gr/
Thanks Sandaysoft

dazza1223
Posts: 172
Joined: Sun Jan 25, 2015 8:41 pm
Weather Station: davis vantage vue
Operating System: raspberry pi 3
Location: worthing
Contact:

Re: webcam

Postby dazza1223 » Tue Apr 04, 2017 9:01 am

so do i put that in the js or html mate

User avatar
vaggos
Posts: 232
Joined: Sat Feb 06, 2010 7:00 pm
Weather Station: PROWEATHER STATION 1080
Operating System: XP SP3, win7, Win10
Location: Acharnes Athens Greece
Contact:

Re: webcam

Postby vaggos » Wed Apr 05, 2017 10:08 am

dazza1223 wrote:so do i put that in the js or html mate


It's script and put it i the place you want to have your webcam image in .html file.
Image
Acharnes Athens Greece Meteo station
http://www.meteoacharnes.gr
https://weather.meteoacharnes.gr/
Thanks Sandaysoft

dazza1223
Posts: 172
Joined: Sun Jan 25, 2015 8:41 pm
Weather Station: davis vantage vue
Operating System: raspberry pi 3
Location: worthing
Contact:

Re: webcam

Postby dazza1223 » Wed Apr 05, 2017 10:11 am

so it gose in the html then?

Code: Select all

[attachment=0]webcam.rar[/attachment]
You do not have the required permissions to view the files attached to this post.

User avatar
beteljuice
Posts: 2455
Joined: Tue Dec 09, 2008 1:37 pm
Weather Station: None !
Operating System: XP SP3 - honest
Location: Dudley, West Midlands, UK

Re: webcam

Postby beteljuice » Thu Apr 06, 2017 12:15 am

Like dazza vaggos said ... (oops)

replace your line #67

Code: Select all

     <img src="/images/webcam.jpg"  width="1000" height="690" name="refreshwebcam"><SCRIPT src="js/webcam_refresh.js" language="JavaScript" type="text/javascript" ></SCRIPT>

With (modified for your image size):

Code: Select all

<IMG name="webcam"
            width="1000" height="690" alt="Please wait the image will appear soon"
            src="../images/webcam.jpg"
            border="0"></A>
<SCRIPT language="JavaScript" type="text/javascript">
interval = 60000;
imgsrc = "../images/webcam.jpg"
tmp = new Date();
tmp = "?" + tmp.getTime();
document.images["webcam"].src = imgsrc + tmp;
setTimeout("Refresh()", interval);
}
Refresh();
</script>


BTW - you have a closing </div> too many @ line #78
Last edited by beteljuice on Thu Apr 06, 2017 9:02 am, edited 2 times in total.
Image
......................Imagine, what you will KNOW tomorrow !

dazza1223
Posts: 172
Joined: Sun Jan 25, 2015 8:41 pm
Weather Station: davis vantage vue
Operating System: raspberry pi 3
Location: worthing
Contact:

Re: webcam

Postby dazza1223 » Thu Apr 06, 2017 8:52 am

thank u i give it a go to night

dazza1223
Posts: 172
Joined: Sun Jan 25, 2015 8:41 pm
Weather Station: davis vantage vue
Operating System: raspberry pi 3
Location: worthing
Contact:

Re: webcam

Postby dazza1223 » Thu Apr 06, 2017 10:13 am

ok it work but it dont auto refresh

Code: Select all

[attachment=0]webcamT (1).rar[/attachment]
You do not have the required permissions to view the files attached to this post.

User avatar
beteljuice
Posts: 2455
Joined: Tue Dec 09, 2008 1:37 pm
Weather Station: None !
Operating System: XP SP3 - honest
Location: Dudley, West Midlands, UK

Re: webcam

Postby beteljuice » Thu Apr 06, 2017 7:05 pm

You didn't "CODE: SELECT ALL"

You missed the closing

Code: Select all

</script>

.. at the end of the code.
Image
......................Imagine, what you will KNOW tomorrow !

dazza1223
Posts: 172
Joined: Sun Jan 25, 2015 8:41 pm
Weather Station: davis vantage vue
Operating System: raspberry pi 3
Location: worthing
Contact:

Re: webcam

Postby dazza1223 » Fri Apr 07, 2017 9:18 am

o sorry i for got that one lol OK i put it in but it still not auto refreshing mate

User avatar
beteljuice
Posts: 2455
Joined: Tue Dec 09, 2008 1:37 pm
Weather Station: None !
Operating System: XP SP3 - honest
Location: Dudley, West Midlands, UK

Re: webcam

Postby beteljuice » Fri Apr 07, 2017 10:03 pm

As we always say ......

a link would be useful !
Image
......................Imagine, what you will KNOW tomorrow !

dazza1223
Posts: 172
Joined: Sun Jan 25, 2015 8:41 pm
Weather Station: davis vantage vue
Operating System: raspberry pi 3
Location: worthing
Contact:

Re: webcam

Postby dazza1223 » Sat Apr 08, 2017 8:50 am


User avatar
beteljuice
Posts: 2455
Joined: Tue Dec 09, 2008 1:37 pm
Weather Station: None !
Operating System: XP SP3 - honest
Location: Dudley, West Midlands, UK

Re: webcam

Postby beteljuice » Sat Apr 08, 2017 12:27 pm

Hmm ...
The only thing I can see (unless some of the jquery stuff is hanging) is that line #73

Code: Select all

imgsrc = "../images/webcam.jpg"

is missing the closing ;

Code: Select all

imgsrc = "../images/webcam.jpg";
Image
......................Imagine, what you will KNOW tomorrow !

dazza1223
Posts: 172
Joined: Sun Jan 25, 2015 8:41 pm
Weather Station: davis vantage vue
Operating System: raspberry pi 3
Location: worthing
Contact:

Re: webcam

Postby dazza1223 » Sat Apr 08, 2017 4:37 pm

lol nope when i put that in it dont even show the photo

User avatar
Toxic17
Posts: 545
Joined: Mon May 19, 2014 10:45 pm
Weather Station: Davis Vantage Pro2 Plus
Operating System: Debian 9.1 Stretch
Location: Bangor, NI
Contact:

Re: webcam

Postby Toxic17 » Sat Apr 08, 2017 5:03 pm

You have a <img> tag, so why are you using "imgsrc" attribute ?

it should be "src" not "imgsrc"

Code: Select all

<img src="../images/webcam.jpg" name="webcam" width="1000" height="690" alt="Please wait the image will appear soon" border="0" />


remove the </a> too. this is only used is html ref to links, not img. img can close with just />
Regards Simon

https://www.conligwx.org
https://twitter.com/conligwx
Davis Vantage Pro2+ - CumulusMX v3.0.0 (build 3043) + Saratoga/PWS
Image


Return to “Web site - General”

Who is online

Users browsing this forum: No registered users and 5 guests