I found Thinkdream's EXIF gizmo (inhis theme and posted on this forum). Has anyone yet found a similar way to display IPTC info?
I found a thing for folderblog (
http://elwing.byethost.com/journal/?page_id=25) and a similar one for PixelPost. But I like ZenPhoto's albums and FTP-ability, so it'd be great if anyone figured it out here...
Comments
Here's what I had working, you might be able to make something of it:
// IPTC Data Information for EXIF Display
function output_iptc_data( $image_path ) {
// --------- Set up Array Functions --------- //
$iptcTags = array (
"2#000" => "Record Version",
"2#003" => "Object Type Reference",
"2#005" => "Object Name (Title)",
"2#007" => "Edit Status",
"2#008" => "Editorial Update",
"2#010" => "Urgency",
"2#012" => "Subject Reference",
"2#015" => "Category",
"2#020" => "Supplemental Category",
"2#022" => "Fixture Identifier",
"2#025" => "Keywords",
"2#026" => "Content Location Code",
"2#027" => "Content Location Name",
"2#030" => "Release Date",
"2#035" => "Release Time",
"2#037" => "Expiration Date",
"2#035" => "Expiration Time",
"2#040" => "Special Instructions",
"2#042" => "Action Advised",
"2#045" => "Reference Service",
"2#047" => "Reference Date",
"2#050" => "Reference Number",
"2#055" => "Date Created",
"2#060" => "Time Created",
"2#062" => "Digital Creation Date",
"2#063" => "Digital Creation Time",
"2#065" => "Originating Program",
"2#070" => "Program Version",
"2#075" => "Object Cycle",
"2#080" => "By-Line (Author)",
"2#085" => "By-Line Title (Author Position) [Not used in Photoshop 7]",
"2#090" => "City",
"2#092" => "Sub-Location",
"2#095" => "Province/State",
"2#100" => "Country/Primary Location Code",
"2#101" => "Country/Primary Location Name",
"2#103" => "Original Transmission Reference",
"2#105" => "Headline",
"2#110" => "Credit",
"2#115" => "Source",
"2#116" => "Copyright Notice",
"2#118" => "Contact",
"2#120" => "Caption/Abstract",
"2#122" => "Caption Writer/Editor",
"2#125" => "Rasterized Caption",
"2#130" => "Image Type",
"2#131" => "Image Orientation",
"2#135" => "Language Identifier",
"2#150" => "Audio Type",
"2#151" => "Audio Sampling Rate",
"2#152" => "Audio Sampling Resolution",
"2#153" => "Audio Duration",
"2#154" => "Audio Outcue",
"2#200" => "ObjectData Preview File Format",
"2#201" => "ObjectData Preview File Format Version",
"2#202" => "ObjectData Preview Data"
);
$size = getimagesize ( $image_path, $info);
if(is_array($info)) {
$iptc = iptcparse($info["APP13"]);
foreach (array_keys($iptc) as $s) {
$c = count ($iptc[$s]);
for ($i=0; $i <$c; $i++)
{
echo '
'.$iptcTags[$s].' = '.$iptc[$s][$i].'
';
}
}
}
}
Also, I'd probably delete most of the IPTC tags since I'm only intererested in Keywords, Locations, and Captions.
It surprises me that all these PhotoBlog apps are focused on the gear (exif) rather than content (iptc).
i would guess that exif is much more beneficial to most users, as the IPTC assumes the user is outputting information from an image editor, rather than EXIF which is directly from a camera. Most people aren't willing to take the time to edit the IPTC tags unless they are graphic designers or artists. The EXIF tags in most cases (provided you have a compatible camera) are always there.
Eventually, I'd like to see title and description read into the DB automatically when a photo is uploaded, but until then, some kind of template functions to selectively display IPTC fields would do the trick.
Any further developments with this code, thinkdreams? It looks like it just loops through all available IPTC data. Is there any way to tell it to print only certain fields?
do you recall what needs to be passed to `output_iptc_data();` It's taking $image_path as an argument, but I don't know what to use in my image.php file to pass the required info.
Thanks.
One thing you might want to look at, not trying to add yet another library for consideration, is: http://www.ozhiker.com/electronics/pjmt/
It's one I looked at a while back, and does lots of different metadata formats. Might be just the ticket for you to add IPTC capability.
To answer your other question, you can try `"../" . getFullImageURL()` (or some variation thereof) and that may be just the ticket. That function returns the image URL which you should be able to pass to the function. It's the same path I used for my old EXIF function to feed it the image URL for EXIF tag reading.
That library appears to be offline for the time being...
It looks like my host doesn't have the IPTC module compiled. When I run your code, I get:
`Warning: array_keys() [function.array-keys]: The first argument should be an array in /full/path/zentest/trunk/zen/exif/makers/iptc.php on line 67
Warning: Invalid argument supplied for foreach() in /full/path/zentest/trunk/zen/exif/makers/iptc.php on line 67`
I've contacted them to see if they'll compile it for me.
I've got the script working now in a very rudimentary form, will post when I work out a method for extracting desired data for display.
If the image doesn't have IPTC tags, the script falls back on zen template functions to display title and description from the database.
Get the code here: Ticket #100
Thanks to thinkdreams for doing the initial research and building the array to index IPTC tag names.
The functions are pretty tailored for displaying IPTC data, but if someone wants to tear this up and see if they can read IPTC title/description during upload, and write it to the database, that would be the logical next step.
For now, though, this should work well enough for those of you who use IPTC on the desktop and don't want to re-enter the info in zenphoto.
I wasn't aware the IPTC parsing capability was available in the svn exif code, i'll have to investigate that further. That would be really cool.
i'll be taking a peek too. we'll compare notes and see if we can come up with a way to integrate it into the exifixer libs in the SVN.
as of v1.5 of exifixer, it does parse the raw data, i think it might be as simple as creating lookups for the iptc data as well. Might be as simple as returning the $result array and seeing what's in there, especially using an image with IPTC tags in it, so we can get an idea of the raw data.
This image should have keywords, title, caption embedded in it. I am including your file in my functions.php page and using the function getIPTC('title');
It could be that your Canon stores the tags differently than my Nikon, and the IPTC parser in PHP doesn't know how to extract them... I have to confess I have no idea how portable the $iptcTags array is, or if there's a better way of getting at the tag data. I'll try and chase down some documentation on the iptc parser.