note 14063 added to function.iptcparse.php

From: Date: Sun, 15 Jul 2001 20:35:48 +0000
Subject: note 14063 added to function.iptcparse.php
Groups: php.notes 
Request: Send a blank email to php-notes+get-15407@lists.php.net to get a copy of this message
This took me longer than it ought to to figure out. Very handy for handling a stream of photos where the info you want is in the IPTC header. This example passes by reference, for which PHP4 will yell at you. If your need to write into the header, check out the Image::IPTCInfo Perl module. $size = GetImageSize ("$image_name",&$info); $iptc = iptcparse ($info["APP13"]); if (isset($info["APP13"])) { $iptc = iptcparse($info["APP13"]){ if (is_array($iptc)) { $caption = $iptc["2#120"][0]; $graphic_name = $iptc["2#005"][0]; $urgency = $iptc["2#010"][0]; $category = $iptc["2#015"][0]; // note that sometimes supp_categories contans multiple entries $supp_categories = $iptc["2#020"][0]; $spec_instr = $iptc["2#040"][0]; $creation_date = $iptc["2#055"][0]; $photog = $iptc["2#080"][0]; $credit_byline_title = $iptc["2#085"][0]; $city = $iptc["2#090"][0]; $state = $iptc["2#095"][0]; $country = $iptc["2#101"][0]; $otr = $iptc["2#103"][0]; $headline = $iptc["2#105"][0]; $source = $iptc["2#110"][0]; $photo_source = $iptc["2#115"][0]; $caption = $iptc["2#120"][0]; }} http://www.php.net/manual/en/function.iptcparse.php

« previous php.notes (#15407) next »