Page 1 of 2
webcam
Posted: Sun 02 Apr 2017 10:58 pm
by dazza1223
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();
Re: webcam
Posted: Tue 04 Apr 2017 5:28 am
by vaggos
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)
Re: webcam
Posted: Tue 04 Apr 2017 9:01 am
by dazza1223
so do i put that in the js or html mate
Re: webcam
Posted: Wed 05 Apr 2017 10:08 am
by vaggos
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.
Re: webcam
Posted: Wed 05 Apr 2017 10:11 am
by dazza1223
so it gose in the html then?
Code: Select all
[attachment=0]webcam.rar[/attachment]
Re: webcam
Posted: Thu 06 Apr 2017 12:15 am
by beteljuice
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
Re: webcam
Posted: Thu 06 Apr 2017 8:52 am
by dazza1223
thank u i give it a go to night
Re: webcam
Posted: Thu 06 Apr 2017 10:13 am
by dazza1223
ok it work but it dont auto refresh
Code: Select all
[attachment=0]webcamT (1).rar[/attachment]
Re: webcam
Posted: Thu 06 Apr 2017 7:05 pm
by beteljuice
You didn't "CODE: SELECT ALL"
You missed the closing
.. at the end of the code.
Re: webcam
Posted: Fri 07 Apr 2017 9:18 am
by dazza1223
o sorry i for got that one lol OK i put it in but it still not auto refreshing mate
Re: webcam
Posted: Fri 07 Apr 2017 10:03 pm
by beteljuice
As we always say ......
a link would be useful !
Re: webcam
Posted: Sat 08 Apr 2017 8:50 am
by dazza1223
Re: webcam
Posted: Sat 08 Apr 2017 12:27 pm
by beteljuice
Hmm ...
The only thing I can see (unless some of the jquery stuff is hanging) is that line #73
is missing the closing
;
Re: webcam
Posted: Sat 08 Apr 2017 4:37 pm
by dazza1223
lol nope when i put that in it dont even show the photo
Re: webcam
Posted: Sat 08 Apr 2017 5:03 pm
by ConligWX
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 />