System information
An Introduction to PHP3
Axis Communications AB provides NO support for application development of any kind. The information
here is provided "as is", and there is no guarantee that any of the examples shown will work in your
particular application.
Revision 1.02 October 2002 39
The script itself:
error_reporting(E_ALL);
error_log("Stopping buffer(s)",0);
for($c=0;$c<(strlen($sources));$c++)
{ // Stop the, by utask,
//started buffers
$command="bufferd -stop -buffername
".$buffer_prefix.substr($sources,$c,1);
system($command);
}
for($c=0;$c<(strlen($sources));$c++)
{ // For each buffer specified
$status_file = "/tmp/".$buffer_prefix.substr($sources,$c,1)."/status";
error_reporting(0);
while(!is_file($status_file))
{ // Wait until bufferd is ready
//with the images, i.e. the status
//file is present
sleep(($predelay+$postdelay)/1000);
}
unlink($status_file);
}
error_reporting(E_ALL);
for($c=0;$c<(strlen($sources));$c++)
{ // For each buffer, mail the
//directory containing the images
//taken
$command = "smtpclient";
$command .=" -S ".$smtp_server;
$command .=" -b ".$body;
$command .=" -M 2 -d /tmp/".$buffer_prefix.substr($sources,$c,1);
$command .=" -s ".$subject;
$command .=" -f ".$from;
$command .=" -r ".$reply;
$command .=" -c ".$cc;
$command .=" ".$to;
system($command);
}
error_log("Restarting buffer(s)",0);
for($c=0;$c<(strlen($sources));$c++)
{ //Reset and restart buffers
$command="bufferd -reset -buffername
".$buffer_prefix.substr($sources,$c,1);
system($command);
$command="bufferd -start -buffername
".$buffer_prefix.substr($sources,$c,1)." -pre ".strval($pre)." -post
".strval($post)." -predelay ".strval($predelay)." -postdelay
".strval($postdelay)." -uri
ftp://jpg/".substr($sources,$c,1)."/".$image_format.".jpg";
system($command);
}
?>