/ Published in: PHP

Currenty getImagInfo() also call getImageXMP() so you only need the first function to get your infos.
Expand |
Embed | Plain Text
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; }
Comments

You need to login to post a comment.
I'm getting a parse error for getImageXMP:
Parse error: syntax error, unexpected ';' in C:\wamp\www\Tests\test.php(48) : eval()'d code on line 1
on $key = 9 and another one at $key = 11
I just updated the code... everything should work fine.
Unfortunately Parse error: syntax error, unexpected ';' in /var/www/exif.php(60) : eval()'d code on line 1
The only thing I added was a call to that function