EXIF and IPTC - reads data from JPEG

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • infoseekar
    New Member
    • Mar 2008
    • 34

    #1

    EXIF and IPTC - reads data from JPEG

    Does anyone know what's the right code to read IPTC metadata.

    I have the code to read EXIF metadata and it gives me alot of information which I don't need. How do I modify this code so it only give the information i required.

    EXIF inout code

    [code=php]

    <?php
    $path="image.jp eg";
    $exif = exif_read_data( $path, 0, true);
    echo "$path:<br />\n";
    foreach ($exif as $key => $section) {
    foreach ($section as $name => $val) {
    echo "$key.$name : $val<br />\n";
    }
    }
    ?>

    [/code]

    EXIF output - when this code was fire it produce the following output.
    Code:
    hp.jpg: //file name
    FILE.FileName: hp.jpg
    FILE.FileDateTime: 1171878580
    FILE.FileSize: 5705
    FILE.FileType: 2
    FILE.MimeType: image/jpeg
    FILE.SectionsFound: APP12
    COMPUTED.html: width="170" height="190"
    COMPUTED.Height: 190
    COMPUTED.Width: 170
    COMPUTED.IsColor: 1
    APP12.Company: Ducky
    APP12.Info: 
    thanks
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    Just set the keys that you want to print in an array and check that before echoeing the key and value:[php]$okay=array('FI LE.FileType', 'FILE.MimeType' , 'COMPUTED.html' );
    foreach ($exif as $key => $section) {
    foreach ($section as $name => $val) {
    if (in_array($name , $okay))
    echo "$key.$name : $val<br />\n";
    }
    }
    [/php]Ronald

    Comment

    • infoseekar
      New Member
      • Mar 2008
      • 34

      #3
      Originally posted by ronverdonk
      Just set the keys that you want to print in an array and check that before echoeing the key and value:[php]$okay=array('FI LE.FileType', 'FILE.MimeType' , 'COMPUTED.html' );
      foreach ($exif as $key => $section) {
      foreach ($section as $name => $val) {
      if (in_array($name , $okay))
      echo "$key.$name : $val<br />\n";
      }
      }
      [/php]Ronald
      Nothing was appreared on the display, except the file name.

      [code=php]

      <?php
      $path="image.jp eg";
      $exif = exif_read_data( $path, 0, true);
      echo "$path:<br />\n";

      $okay=array('FI LE.FileType', 'FILE.MimeType' , 'COMPUTED.html' );
      foreach ($exif as $key => $section) {
      foreach ($section as $name => $val) {
      if (in_array($name , $okay))
      echo "$key.$name : $val<br />\n";
      }
      }
      ?>

      [/code]

      what about if I use extract function then echo the array (ie echo "$FILE.FileName ")

      thanks

      Comment

      • infoseekar
        New Member
        • Mar 2008
        • 34

        #4
        Originally posted by infoseekar
        Nothing was appreared on the display, except the file name.

        [code=php]

        <?php
        $path="image.jp eg";
        $exif = exif_read_data( $path, 0, true);
        echo "$path:<br />\n";

        $okay=array('FI LE.FileType', 'FILE.MimeType' , 'COMPUTED.html' );
        foreach ($exif as $key => $section) {
        foreach ($section as $name => $val) {
        if (in_array($name , $okay))
        echo "$key.$name : $val<br />\n";
        }
        }
        ?>

        [/code]

        what about if I use extract function then echo the array (ie echo "$FILE.FileName ")

        thanks

        PROBLEM SOLVED :: Thanks Ronald

        [code=php]

        <?php
        $path="image.jp eg";
        $exif = exif_read_data( $path, 0, true);
        echo "$path:<br />\n";

        echo $exif ['FILE'][FileName'];
        ?>

        [/code]

        Comment

        • ronverdonk
          Recognized Expert Specialist
          • Jul 2006
          • 4259

          #5
          See you next time around.

          Ronald

          Comment

          • infoseekar
            New Member
            • Mar 2008
            • 34

            #6
            Originally posted by ronverdonk
            See you next time around.

            Ronald
            Back again Ronald!

            How do i read IPTC metadata in PHP. I suppose its gonna be similar to EXIF metadate code. Any idea any one.

            many thanks in advance

            Comment

            • ronverdonk
              Recognized Expert Specialist
              • Jul 2006
              • 4259

              #7
              There is an ITPCPARSE() command in the PHP manuald, see HERE

              Ronald

              Comment

              • infoseekar
                New Member
                • Mar 2008
                • 34

                #8
                Originally posted by ronverdonk
                There is an ITPCPARSE() command in the PHP manuald, see HERE

                Ronald
                PROBLEM SOLVED- Thanks Ronald

                Comment

                • ronverdonk
                  Recognized Expert Specialist
                  • Jul 2006
                  • 4259

                  #9
                  You are welcome. See you around.

                  Ronald

                  Comment

                  Working...