Exif init.php

From ElphelWiki
Jump to: navigation, search

exif_init.php - Exif template generator for Elphel 353 series cameras

This is a PHP script that runs before starting the [Imgsrv|imgsrv] image server. In the current setup it is executed as a part of startup script when /etc/init.d/imgsrvd is executed:

...
   8                 php-fcgi -q  /usr/html/exif_init.php  >/dev/null
   9 		start_daemon /usr/local/sbin/imgsrv -p 8081
...

and the generated template file /var/state/exif.template is read in only once - at the imgsrv start up. So if you want to modify the Exif data attached to the camera images, you will need to re-run the script and kill the imgsrv (it will be respawned automatically). The script can be rerun with opening url http://<camera_ip>/exif_init.php, where <camera_ip> should be replaced with the actual camera IP address.

The Exif data source is described in the array:

$Exif=array (
"IFD" => array(
 array(0x010e,2,"Description 0x41 bytes long                                      "), //Description
 array(0x010f,2,"Elphel, Inc."),                   // Manufacturer
 array(0x0110,2,"353    "),                        // Model TODO: make more intelligent guess - what camera is it
 array(0x0131,2,getSoftware()),                    // Software - "ls /usr/html/docs"
 array(0x0132,2,"2001:06:21 12:00:00","len"=> 20), //date/time modified, always use 20 bytes
 array(0x013b,2,getSerial()),                      // "bootblocktool -x SERNO" - add colons
 array(0x8769,4,0)                                 // address of subIFD
              ),
 "SUB_IFD" => array(
 array(0x829a,5,array("nominator"=>1,"denominator"=>10000)), // exposure time
 array(0x9003,2,"2001:06:21 12:00:00","len"=> 20),           //date/time original time created, always use 20 bytes
 array(0x927c,1,0,"len"=> 36), //!Manufacture custom data - raw data from the frame_params_t structure
 array(0x9291,2,"0        ")                                 //original time sub-second
   )
);

It is possible to modify/add more tags, the script will parse it and prepare the template (see imgsrv for the description of dynamic tags that are needed for the imgsrv)