PHP question ----- Reading EXIF data from image file.

Discussion in 'Chit Chat' started by OptionsOptionsOptions, Sep 29, 2023.

  1. This PHP code reads the EXIF data from an image file
    Code:
    <?php
    $exif = exif_read_data('7.jpg', 0, true);
    
    foreach ($exif as $key => $section) {
        foreach ($section as $name => $val) {
            echo "$key.$name: $val<br />\n";
        }
    }
    ?>
    
    
    The results are below.
    Code:
    FILE.FileName: 7.jpg
    FILE.FileDateTime: 1696015524
    FILE.FileSize: 175898
    FILE.FileType: 2
    FILE.MimeType: image/jpeg
    FILE.SectionsFound: ANY_TAG, IFD0, EXIF, WINXP
    COMPUTED.html: width="750" height="250"
    COMPUTED.Height: 250
    COMPUTED.Width: 750
    COMPUTED.IsColor: 1
    COMPUTED.ByteOrderMotorola: 1
    
    I don't need all rows and columns. For example lets say I want to output only the 250 and 750 in this row:

    COMPUTED.Height: 250
    COMPUTED.Width: 750

    The rows of data are 3 columns, the data I want is in the 3rd column.
    How do I code that?