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 29
4.2.2 Example 2 – FTP Upload of Images
This script will upload 2 pre-alarm and 2 post-alarm images via FTP. It is fairly general and may
be used in many different configurations.
4.2.2.1 The task.list
once immune % /bin/bufferd : -start -buffername CAM1 -pre 2 -post 2 -predelay
1000 -postdelay 1000 -uri ftp://jpg/1/352x288.jpg;
date(w(0,1,2,3,4,5,6)) pattern((IO0:/)) immune once % /bin/sh : -c php
/etc/httpd/html/alarm_ftp_net.php3;
The first entry in the task.list will start a buffer (CAM1) that continuously fetches 2 pre-alarm
images from camera 1 and is prepared to fetch 2 post-alarm images. The images are fetched at
rate of 1 frame per second (1000ms).
The second entry specifies that when input one goes high (rising flank), then the script
alarm_ftp_net.php3 will be executed.
4.2.2.2 The Script
The first section of the script contains the available parameters, which may be changed according
to requirements.
<?
$buffer_prefix = "CAM"; // The prefix of the name
//of the buffer(s) started
$sources = "1"; // The index of the name(s)
//of the buffer(s) started
$image_format = "fullsize"; // The format of the images
//specified to be taken
//according to the HTTP-API
$pre = 2; // Number of pre alarm
//images to be taken
$post = 2; // Number of post alarm
//images to be taken
$predelay = 1000; // Delay between pre images
//in milliseconds
$postdelay = 1000; // Delay between post
//images in milliseconds
$ftp_server = "10.13.9.130"; // The server to upload to
$port = "21"; // The port to connect to
$user = "user"; // The user to login as
$pass = "pass"; // The pass to use for the
//user
$passive_mode = "no"; // Choose passive mode on
//("yes") or off ("no").
//(See documentation on FTP
//protocol)
$destination = "upload/2400test"; // The path to append to
//all uploads. This path
//must exist on the
//server prior to upload.