EXIF (or other meta-data) data that Windows displays but PHP does not

后端 未结 1 1829
借酒劲吻你
借酒劲吻你 2021-01-05 00:36

I am working to pull some information from JPEGs supplied to my client by a photographer.

When examined under Windows all of the images contain data in a field calle

1条回答
  •  再見小時候
    2021-01-05 01:14

    In three points (thanks to jerrygarciuh for his patience and help).

    1) To see extra informations, just pass the third argument to true:

    $exif = exif_read_data("ANI_$n.jpg", 'IFD0', true);
    

    As explained here, it will force the conversion to an array to avoid conflicts between sections. You will find Tags under the IFD0.Keywords keyword.

    2) There is an issue with WINXP.Keywords. To display correctly these informations, just set the encoding to UFT-8:

    ini_set('exif.encode_unicode', 'UTF-8');
    

    3) Thanks to this question from Ferdy, extra informations setted by Lightroom could be read using iptcparse. This is the full script:

    ini_set('exif.encode_unicode', 'UTF-8');  // To see WINXP values
    
    // Exif informations -- limited by PHP
    $exif = exif_read_data("ANI_$n.jpg", 'ANY_TAG', true);
    print_r($exif);
    
    // Additionnal informations from Lightroom
    getimagesize("ANI_$n.jpg", $infos);
    if ( isset($infos['APP13']) ) {
        print_r(iptcparse($infos['APP13']));
    }
    

    Output:

    Array
    (
        [FILE] => Array
            (
                [FileName] => ANI_69.or.jpg
                [FileDateTime] => 1431382165
                [FileSize] => 2450950
                [FileType] => 2
                [MimeType] => image/jpeg
                [SectionsFound] => ANY_TAG, IFD0, THUMBNAIL, EXIF, WINXP
            )
    
        [COMPUTED] => Array
            (
                [html] => width="1798" height="2697"
                [Height] => 2697
                [Width] => 1798
                [IsColor] => 1
                [ByteOrderMotorola] => 1
                [Copyright] => Digital Roux Photography LLC
                [Thumbnail.FileType] => 2
                [Thumbnail.MimeType] => image/jpeg
            )
    
        [IFD0] => Array
            (
                [ImageWidth] => 1798
                [ImageLength] => 2697
                [BitsPerSample] => Array
                    (
                        [0] => 8
                        [1] => 8
                        [2] => 8
                    )
    
                [PhotometricInterpretation] => 2
                [ImageDescription] => Rusty Costanza / Digital Roux Photography
                [Orientation] => 1
                [SamplesPerPixel] => 3
                [XResolution] => 1000000/10000
                [YResolution] => 1000000/10000
                [ResolutionUnit] => 2
                [Software] => Adobe Photoshop CS6 (Macintosh)
                [DateTime] => 2014:12:28 19:17:36
                [Artist] => Digital Roux Photography LLC
                [Copyright] => Digital Roux Photography LLC
                [Exif_IFD_Pointer] => 2468
                [Title] => Rusty Costanza / Digital Roux Photography
                [Keywords] => whooping crane
                [UndefinedTag:0xEA1C] => �
            )
    
        [THUMBNAIL] => Array
            (
                [Compression] => 6
                [XResolution] => 72/1
                [YResolution] => 72/1
                [ResolutionUnit] => 2
                [JPEGInterchangeFormat] => 4894
                [JPEGInterchangeFormatLength] => 3371
            )
    
        [EXIF] => Array
            (
                [ExifVersion] => 0230
                [DateTimeOriginal] => 2014:11:03 11:14:27
                [DateTimeDigitized] => 2014:11:03 11:14:27
                [SubSecTimeOriginal] => 76
                [SubSecTimeDigitized] => 76
                [ColorSpace] => 65535
                [ExifImageWidth] => 1798
                [ExifImageLength] => 2697
                [UndefinedTag:0xEA1C] => �
            )
    
        [WINXP] => Array
            (
                [Title] => 刀甀猀琀礀 䌀漀猀琀愀渀稀愀 ⼀ 䐀椀最椀琀愀氀 刀漀甀砀 倀栀漀琀漀最爀愀瀀栀礀ഀ
                [Keywords] => 眀栀漀漀瀀椀渀最 挀爀愀渀攀
            )
    )
    
    Array
    (
        [1#090] => Array
            (
                [0] => 
            )
    
        [2#000] => Array
            (
                [0] => 
            )
    
        [2#055] => Array
            (
                [0] => 20141103
            )
    
        [2#060] => Array
            (
                [0] => 111427+0000
            )
    
        [2#090] => Array
            (
                [0] => New Orleans
            )
    
        [2#025] => Array
            (
                [0] => whooping crane
            )
    
        [2#080] => Array
            (
                [0] => Digital Roux Photography LLC
            )
    
        [2#120] => Array
            (
                [0] => Rusty Costanza / Digital Roux Photography
            )
    
        [2#116] => Array
            (
                [0] => Digital Roux Photography LLC
            )
    
        [2#221] => Array
            (
                [0] => 0:0:0:-00001
            )
    
        [2#062] => Array
            (
                [0] => 20141103
            )
    )
    

    By the way, nice picture ;)

    0 讨论(0)
提交回复
热议问题