fswebcam is a Linux utility that captures an image using a Video4Linux compatible webcam.


# fswebcam -r 640x480 --jpeg 85 -D 1 web-cam-shot.jpg

Dumping fswebcam images via HTTP[edit]

You can make a quick an dirty wrapper around the command above so that it can be viewed via the web.

system("fswebcam -r 640x480 --jpeg 85 -D 1 /tmp/out.jpg > /dev/null");
header("Content-Type: image/jpeg");
echo file_get_contents("/tmp/out.jpg");