图像元数据信息EXIF和XMP
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了图像元数据信息EXIF和XMP相关的知识,希望对你有一定的参考价值。
Currenty getImagInfo() also call getImageXMP() so you only need the first function to get your infos.
function getImageInfo($img) { if($iptc["2#005"][0] != null) $ret["title"] = $iptc["2#005"][0]; if($iptc["2#080"][0] != null) $ret["author"] = $iptc["2#080"][0]; if($iptc["2#085"][0] != null) $ret["credit"] = $iptc["2#085"][0]; if($iptc["2#090"][0] != null) $ret["city"] = $iptc["2#090"][0]; if($iptc["2#095"][0] != null) $ret["state"] = $iptc["2#095"][0]; if($iptc["2#101"][0] != null) $ret["country"] = $iptc["2#101"][0]; if($iptc["2#105"][0] != null) $ret["title"] = $iptc["2#105"][0]; if($iptc["2#116"][0] != null) $ret["copyright"] = $iptc["2#116"][0]; if($iptc["2#120"][0] != null) $ret["description"] = $iptc["2#120"][0]; if($iptc["2#122"][0] != null) $ret["author"] = $iptc["2#122"][0]; $xmp = getImageXMP($img); foreach($xmp as $key => $value) { if($value != null && $value != "") $ret[$key] = $value; } return $ret; } function getImageXMP($filename) { $xmplenght = $xmpdata_end-$xmpdata_start; array("name" => "copyright", "regexp" => "/<dc:rights>s*<rdf:Alt>s*<rdf:li xml:lang="x-default">(.+)</rdf:li>s*</rdf:Alt>s*</dc:rights>/"), array("name" => "author", "regexp" => "/<dc:creator>s*<rdf:Seq>s*<rdf:li>(.+)</rdf:li>s*</rdf:Seq>s*</dc:creator>/"), array("name" => "title", "regexp" => "/<dc:title>s*<rdf:Alt>s*<rdf:li xml:lang="x-default">(.+)</rdf:li>s*</rdf:Alt>s*</dc:title>/"), array("name" => "description", "regexp" => "/<dc:description>s*<rdf:Alt>s*<rdf:li xml:lang="x-default">(.+)</rdf:li>s*</rdf:Alt>s*</dc:description>/"), array("name" => "iso", "regexp" => "/<exif:ISOSpeedRatings>s*<rdf:Seq>s*<rdf:li>(.+)</rdf:li>s*</rdf:Seq>s*</exif:ISOSpeedRatings>/"), array("name" => "user comment", "regexp" => "/<exif:UserComment>s*<rdf:Alt>s*<rdf:li xml:lang="x-default">(.+)</rdf:li>s*</rdf:Alt>s*</exif:UserComment>/"), ); foreach ($regexps as $key => $k) { $xmp_item = @$r[1]; } return $xmp_parsed; }
以上是关于图像元数据信息EXIF和XMP的主要内容,如果未能解决你的问题,请参考以下文章