如何获得';标题';和';标签';使用PHP从JPEG获取exif数据

如何获得';标题';和';标签';使用PHP从JPEG获取exif数据,php,metadata,exif,Php,Metadata,Exif,我有一大堆JPEG,摄影师给我贴了标签。以下是一个例子: 如何使用PHP读取“标题”和“标签”数据?我尝试过使用exif\u read\u data但它没有返回所有信息,它返回的是: Array ( [FileName] => php57F4.tmp [FileDateTime] => 1517222165 [FileSize] => 10092294 [FileType] => 2 [MimeType] => image/

我有一大堆JPEG,摄影师给我贴了标签。以下是一个例子:

如何使用PHP读取“标题”和“标签”数据?我尝试过使用
exif\u read\u data
但它没有返回所有信息,它返回的是:

Array
(
    [FileName] => php57F4.tmp
    [FileDateTime] => 1517222165
    [FileSize] => 10092294
    [FileType] => 2
    [MimeType] => image/jpeg
    [SectionsFound] => ANY_TAG, IFD0, THUMBNAIL, EXIF
    [COMPUTED] => Array
        (
            [html] => width="6085" height="3513"
            [Height] => 3513
            [Width] => 6085
            [IsColor] => 1
            [ByteOrderMotorola] => 0
            [ApertureFNumber] => f/1.0
            [FocusDistance] => 0.25m
            [Copyright] => 7831 262511, Copyright Retained by SG Phot
            [Copyright.Photographer] => 7831 262511
            [Copyright.Editor] => Copyright Retained by SG Phot
            [Thumbnail.FileType] => 2
            [Thumbnail.MimeType] => image/jpeg
        )

    [ImageDescription] => Ashwell- Countryside Properties
    [Make] => 
    [Model] => Hasselblad
    [Orientation] => 1
    [XResolution] => 1478517857/892159025
    [YResolution] => 25392/300
    [ResolutionUnit] => 2
    [Software] => 
    [DateTime] => (Macintosh)
    [Artist] => 22 17:40:16
    [Copyright] => 7831 262511
    [Exif_IFD_Pointer] => 12204
    [THUMBNAIL] => Array
        (
            [Compression] => 6
            [XResolution] => 72/1
            [YResolution] => 72/1
            [ResolutionUnit] => 2
            [JPEGInterchangeFormat] => 868
            [JPEGInterchangeFormatLength] => 11154
        )

    [ExposureTime] => 7/766
    [FNumber] => 0/3
    [ExposureProgram] => 1
    [ISOSpeedRatings] => 100
    [ExifVersion] => 0230
    [DateTimeOriginal] => 2018:01:16 11:20:35
    [DateTimeDigitized] => 
    [ShutterSpeedValue] => 824194609/825375280
    [ApertureValue] => 3552570/-1584963
    [ExposureBiasValue] => 1000000/8495855
    [MaxApertureValue] => 1000000/0
    [SubjectDistance] => 1/4
    [MeteringMode] => 255
    [Flash] => 0
    [FocalLength] => 1/1119
    [ColorSpace] => 65535
    [FocalPlaneXResolution] => 1000/28
    [FocalPlaneYResolution] => 1/188679
    [FocalPlaneResolutionUnit] => 3
    [FocalLengthIn35mmFilm] => 22
    [ImageUniqueID] => d
    [UndefinedTag:0xA433] => 7200000CD7
    [UndefinedTag:0xA434] => Hasselb
)

由于建议我参考以下答案,我成功地对其进行了排序:

我稍微修改了一下,这是我完成的解决方案:

function get_iptc_data( $image_path ) {
    $return = array('title' => '', 'subject' => '', 'tags' => '');
    $size = getimagesize ( $image_path, $info);

    if(is_array($info)) {
        $iptc = iptcparse($info["APP13"]);
        // var_dump($iptc); // this will show all the data retrieved but I'm only concerned with a few 
        $return['title'] = $iptc['2#005'][0];
        $return['subject'] = $iptc['2#120'][0];
        $return['tags'] = $iptc['2#025'];
    }
    return $return;
}
也许这里有更多的信息:这应该有帮助: