JHEAD on NAS box

  • kito408

    kito408 - 2007-06-12


    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. 


    • kito408

      kito408 - 2007-06-15


      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



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

          // 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:
      2848 x 2136
      1540451 bytes
      2007:06:13 17:54:00
      FinePix E550  
      2007:05:20 11:45:48
      Yes (auto)
      9.3mm  (35mm equivalent: 62mm)
      0.017 s  (1/60)
      program (auto)


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks