Page 1 of 1

Sloppy Webcam

Posted: Sat May 18, 2013 2:59 pm
by davef21370
I have a simple webcam set up over my home network. It uses a Python script to take an image every few seconds and save it to the relevant folder which all works fine. My problem is with the HTML to update the image....

Code: Select all

<html>
	<head>
		<title>
			Webcam
		</title>
		<meta http-equiv='refresh' content='3'; url='index.html'>
	</head>
	<body>
		<div align='center'>
			<img src="image.jpg">
		</div>
	</body>
</html>
This forces the browser to update the entire page every 3 seconds which is a bit rubbish to say the least.

What would be a more elegant solution? (I'm fine with coding but new to php, java, etc.)

Any help would be great.
Dave.

Re: Sloppy Webcam

Posted: Wed May 29, 2013 3:13 pm
by SirLagz
Do you know about https://en.wikipedia.org/wiki/Ajax_(programming) AJAX?

Also, jQuery.
http://jquery.com

There are 2 starting points.
Essentially, you need to code it up so jQuery uses ajax to update the image only.

Re: Sloppy Webcam

Posted: Wed May 29, 2013 5:21 pm
by davef21370
Thanks for the reply, I did a quick search based on AJAX and ended up with a JavaScript example here http://www.tek-tips.com/viewthread.cfm?qid=1546531

Cheers.
Dave.