Skip to content

Instantly share code, notes, and snippets.

@haku
Created April 29, 2012 09:33
Show Gist options
  • Save haku/2549023 to your computer and use it in GitHub Desktop.
Save haku/2549023 to your computer and use it in GitHub Desktop.
Bare-bones webcam server
== installation ==
sudo aptitude install apache2 php5
cd /var/www
sudo mkdir cam0
sudo chown root:www-data cam0
cd cam0
sudo cp $src/index.php .
sudo mkdir tmp
sudo chown root:www-data tmp
sudo chmod g+w tmp
sudo usermod -a -G video www-data
sudo service apache2 restart
<?php
$picfile="/var/www/cam0/tmp/webpic.jpeg";
if (isset($_POST['refresh'])) {
exec("streamer -q -s 960x720 -c /dev/video0 -j 100 -o $picfile");
header('Location: /cam0');
exit;
}
date_default_timezone_set('UTC');
$moddate = date("F d Y H:i:s", filemtime($picfile));
?>
<html><body>
<form method="POST" >
<input type="submit" name="refresh" value="refresh" >
<?php echo "$moddate" ?> desu~
</form>
<img src="tmp/webpic.jpeg" >
</body></html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment