ZenphotoCMS Forum
IPTC "plugin" - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: IPTC "plugin" (/thread-676.html)

Pages: 1 2


IPTC "plugin" - jimhere - 15-07-2006

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...




IPTC "plugin" - thinkdreams - 18-07-2006

Jimhere-

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




IPTC "plugin" - thinkdreams - 18-07-2006

In retrospect, it doesn't really do a whole lot, but it does display IPTC data.




IPTC "plugin" - jimhere - 18-07-2006

Thanks. Would I paste this into a new "iptc.inc.php" doc in your theme? I see you put require_once("exif.inc.php"); in your thinkdreams-functions.php do I repeat that?

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).




IPTC "plugin" - thinkdreams - 18-07-2006

put the whole output_iptc_data function (including the array) into your functions.php file. you then need to call it from somewhere in your image.php file, and pass it the image information.

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.




IPTC "plugin" - dspnorman - 26-07-2007

IPTC support is actually a critical feature from my perspective: I have a large number of images with IPTC caption data, and the prospect of re-entering that information manually is daunting.

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?




IPTC "plugin" - thinkdreams - 26-07-2007

Nope. I really abandoned that code direction when Tris started moving toward his own EXIF library direction. The EXIF library that is in the code now I don't think has any IPTC functionality, which means a separate IPTC library might be the way to go.




IPTC "plugin" - dspnorman - 26-07-2007

Cool, I'll see if I can hack your code into an interim solution for now. I don't have the php savvy to implement a whole new external library.




IPTC "plugin" - dspnorman - 26-07-2007

@thinkdreams,

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.




IPTC "plugin" - thinkdreams - 27-07-2007

@dspnorman-

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.




IPTC "plugin" - thinkdreams - 27-07-2007

Note also that in the IPTC function I mentioned above in the very beginning of this post, it uses a built-in PHP library (not an external library) to handle IPTC tags. Thus, this would assume that people who use it have the library compiled in their PHP setup, which is why it was decided to go with an external library for EXIF. So eventually, you'd want to look at an external library.




IPTC "plugin" - dspnorman - 27-07-2007

Thanks thinkdreams.

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.




IPTC "plugin" - dspnorman - 27-07-2007

Update: IPTC support was working, but my test image had no data. Oops!

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.




IPTC "plugin" - dspnorman - 01-08-2007

Alright, I've got a decent function to display IPTC title and description info.

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.




IPTC "plugin" - dspnorman - 02-08-2007

Should have mentioned, I wrote and tested this on the current SVN code, but see no reason it should not also work with the current 1.0.8.2 release. The IPTC is actually parsed by a native PHP library, and there's no reliance on any of the newer EXIF support in zenphoto. Really, it's a bare bones hack.




IPTC "plugin" - trisweb - 02-08-2007

Is there a reason you didn't use the existing EXIF/IPTC library already in SVN? AFAIK it works quite well for IPTC data as well as EXIF....




IPTC "plugin" - thinkdreams - 02-08-2007

tris-

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.




IPTC "plugin" - dspnorman - 02-08-2007

Likewise, I didn't know the library supported IPTC. I'm under no illusion that this anything but a hack -- if there's a better way of implementing IPTC display, I'll investigate.




IPTC "plugin" - thinkdreams - 02-08-2007

@ds-

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.




IPTC "plugin" - dspnorman - 02-08-2007

Well, so far I've found some mentions of IPTC in Exifer, but haven't found an easy way to pull IPTC data. All the existing functions seem to deal with a pretty specific set of EXIF tags defined in an array.