<?

// CRONSETTING
// You can run this script either as a standalone program, or run it
// at regular intervals, using cron.
// If you run the script from the crontab, REMEMBER to set usecron=0, 
// or you will have a large number of processes running in no time.

$usecron=0; // [0] WHEN SCRIPT IS RUNNING AS A STANDALONE PROGRAM
            //  [1] USE WHEN SCRIPT IS RUN USING CRONTAB


// MODE
// You can specify whether motion should detected with reference
// to the last taken snapshot[1], or to the last taken snapshot 
// where motion was detcted[0] 

$mode=1; // [0] Calculate motion with regards to last stored image
         // [1] Calculate motion with regards to last taken snapshot


// CAPTURE SETTINGS
// Specify option for streamer. You could just specify the path
// and options to any other command line tool you use
// to take snapshots. It must currently output JPEG.

//$capture="/usr/bin/streamer -s 640x480 -o";
$capture="/usr/bin/streamer -s 320x240 -o";
//$capture="/usr/bin/streamer -s 160x120 -o";


// DIRECTORIES

$outdir="/tmp"; // THIS IS THE DIRECTORY WHERE ALL FILES ARE WRITTEN AND ARCHIVED
                // MAKE SURE THE USER TAT RUNS THE PHP SCRIPTS HAS READ/WROTE ACCESS

$old="$outdir/kontor_old.jpeg"; // TEMP OLD FILE
$new="$outdir/kontor_new.jpeg"; // TEMP NEW FILE


// DETECT MOTION WHEN DEGREE OF MOTION IS BOVE threshold.
$threshold=2.5; // DETECT MOTION WHEN THRESHOLD IS ABOVE THIS LEVEL
               // [0] STORE ALL SNAPSHOTS
               // [4] STORE ONLY WHEN PEOPLE ARE MOVING (APP)
               // [50] STORE NO SNAPSHOTS 


// VERBOSE LEVEL
$verbose=1; // [-1] NOTHING, 
             // [0] SHOW WHEN MOTION IS DETECTED, 
             // [1] SHOW INFO ABOUT EACH IMAGE
             // [20] SHOW ALL INFO AVAILABLE


///
/// WWW intergace settings
///

// MYSQL DATABASE SETTINGS
// If you have access to a MySQL database you should specify it here.
// This is needed to use to WWW interface.
$usedb=1;


$host = '127.0.0.1';
$port = '';
$user = 'root';
$password = '';
$usebase = 'motiondetect';




// REFRESH BROWSE PAGE
$http_refresh=60; // REFRESH RATE IN SECONDS

// MOVIE CREATION
// ADD MORE SECTIONS IF YOU WANT TO USE ANOTHER TOOL
// IF YOU USE ANYTHING REALLY NICE AND COOL PLEASE SEND ME A NOTE AND TELL ME HOW (thomas@lixnet.dk)
$i=0;
$i++;
$movie[$i]['name']    = 'MPEG - Image Magick';
$movie[$i]['cmd']    = "/usr/X11R6/bin/convert -delay DELAY TMPDIR/* MOVIEFILE.FORMAT";
$movie[$i]['format']    = 'mpeg';
$movie[$i]['converttogif']    = 0;
$i++;
$movie[$i]['name']    = 'GIF - Image Magick';
$movie[$i]['cmd']    = "/usr/X11R6/bin/convert -delay DELAY TMPDIR/* MOVIEFILE.FORMAT";
$movie[$i]['format']    = 'gif';
$movie[$i]['converttogif']    = 0;
$i++;
$movie[$i]['name']    = 'GIF - GifSicle';
$movie[$i]['cmd']    = "/usr/bin/gifsicle --delay=DELAY --loop --optimize --colors 256 TMPDIR/*.gif > MOVIEFILE.FORMAT";
$movie[$i]['format']    = 'gif';
$movie[$i]['converttogif']    = 1;

// PATH TO MOGRIFY BINARY :
$mogrify = '/usr/X11R6/bin/mogrify';

?>