Life on the third coast

OSX Webcam Instructions

To run an iSight webcam first make a directory off your home directory. Call it webcam or something like that.

I downloaded isightcapture from Intergalactic. This free, but not open source, program will grab a picture from your iSight. Put this program in your new webcam directory.

To ftp the pictures up to your website you need to create a perl program ‘webcam.pl’
This perl program takes and uploads a picture every 300 seconds ( 5 minutes ) change the number of seconds to suit you.

#loop forever or until program terminated
while (){

$takepicture = “./isightcapture snapshot.jpg”;
print $takepicture.”\n”;
if ( system($takepicture)) { print “failed to take picture\n”; }

$uploadpicture = “ftp < upload”;
print $uploadpicture.”\n”;
if ( system($uploadpicture)) { print “failed to upload picture\n”; }



Now make that file executable at a command prompt type
>chmod 755 webcam.pl

Next create a .netrc file in your home directory substituting yourwebsite.com, yourloginame and yourpassword. Be sure permissions are set to 600 ( chmod 600 .netrc ).

machine yourwebsite.com
login yourloginname
password yourpassword

{this is highly insecure, your password is in plain text so use this at your own risk!}

Finally create the upload file. snapshot.jpg is the name of the picture that isightcapture takes. Change yourwebsite.com and yourwebcamdirectory to be the name of your website and the directory on your website you are uploading your snapshots into.

open yourwebsite.com
cd yourwebcamdirectory
put snapshot.jpg

Once all this is done and everything is in the same directory except .netrc open a new terminal window, cd to your webcam directory. Type ./webcam.pl and you’re taking and uploading pictures. You will see the output from isightcapture and the ftp program. So any problems should be clear to you and easy to fix.

Now in your webpage just put in a link to the picture to have the current picture appear in a webpage.

*All these sample files can be downloaded osxwebcam.tar.gz