JHEAD on NAS box

kito408
2007-06-12
2013-06-03
  • kito408
    kito408
    2007-06-12

    Hi,

    I am running phpgraphy on a NAS box (QNAP TS-101).  The tiny box has a web server with PHP running on it.  Its very stripped down ulinux dist.  I like the box very much becuase its silent and uses very little power.  I am very happy to be able to use the advanced features of phpgraphy over the built in photo viewer.  The one thing I would like is the exif header info for my photos.  Unfortunetly my NAS box does not support phpgraphy's exif reading which I am assuming comes from a compiled in option for PHP. 

    The NAS box does however include a binary jhead which is used in its own picture viewer.  Jhead is a console app which will display the exif info given the pictire filename.  The idea of me recompiling PHP on a customized distro is beyond my facailities, but I am thinking I could modify the phpgraphy source to run jhead and dump the data when the large version of a picture is displayed.  I am not php savvy, but I think this would be easy thing to do myself.  I read up a little on pgp and the exec command.  If any guru's can point me in the right direction I would appreciate it. 

    Thanks,
    Kito

     
    • kito408
      kito408
      2007-06-15

      Hi,

      I modified the end of index.php and added a simple system command.  It does a rather dumb dump of the jhead output.  Its not very pretty, but its a start. I probably will switch to exec command and generate field names and generate html output for each line item. 

      Is this an ok place to put the jhead

      Thanks.

      -Kito

      CODE ADD:
          } elseif ($mode == 'display') {
      /// REMOVED CODE
              // Everything has been prepared - let's display it !
              $tpl->display('display.tpl');

          // BEGIN ADDED CODE HERE KITO ========
           if (preg_match("/jpe?g/i",$display)) {
                 echo '<pre>';
                 $last_line = system('/usr/local/sbin/jhead '.$config['pictures_dir'].$display, $retval);
                 echo '</pre>';
              }       
          // END ADDED CODE HERE KITO =========

      EXAMPLE JHEAD output:
      DSCF0169.JPG
      2848 x 2136
      1540451 bytes
      2007:06:13 17:54:00
      FUJIFILM
      FinePix E550  
      2007:05:20 11:45:48
      Yes (auto)
      9.3mm  (35mm equivalent: 62mm)
      5.38mm
      0.017 s  (1/60)
      f/3.1
      200
      Auto
      matrix
      program (auto)