Putting IPTC Caption in Photo title at upload

Joe Siegler
Joe Siegler's picture

Joined: 2005-09-14
Posts: 54
Posted: Mon, 2009-08-03 22:04

I've done some reading around, and it doesn't appear there's an (easy, anyway) way of doing this. I have a bunch of captions of photos in Picasa, and when I export them for upload to Gallery, Picasa sticks my caption in the IPTC Caption field. Which is fine.

However, on the Gallery side, the only place I can get this imported is to put it in the Item Summary or the Item Description. I want them in the Item TITLE, not either of those fields listed.

I don't believe there's a way to re-route the info at upload, is there? Is there a hack that will allow me to do this, or an updated EXIF/IPTC module or something?

There isn't some trick where I can put something like %IPTC:Caption% in the Caption field at upload time, and tell it to use the caption for the title?

 
Joe Siegler
Joe Siegler's picture

Joined: 2005-09-14
Posts: 54
Posted: Mon, 2009-08-03 22:13

Hmm.. I looked here:

http://codex.gallery2.org/Gallery2:Modules:exif

The following text appears:

Quote:
# Can be configured to read particular EXIF/IPTC fields and use these to populate item title, summary, description or keywords for newly uploaded photos

Seems to be that I can do what I want to do from this text. But how? My version of Gallery is 2.2, and my EXIF/IPTC plugin is 1.1. Would this be solved by upgrading to 2.3? Didn't notice until right this minute that I wasn't at current code.

 
Joe Siegler
Joe Siegler's picture

Joined: 2005-09-14
Posts: 54
Posted: Tue, 2009-08-04 21:46
Joe Siegler wrote:
Would this be solved by upgrading to 2.3? Didn't notice until right this minute that I wasn't at current code.

It wasn't. Upgraded to 2.3, and nothing changed there, so how do I activate the "populate item title" with IPTC captions?

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Tue, 2009-08-04 22:06

Had to dig into this because I don't use that plugin. Site Admin > EXIF/IPTC
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
Joe Siegler
Joe Siegler's picture

Joined: 2005-09-14
Posts: 54
Posted: Tue, 2009-08-04 23:16
nivekiam wrote:
Had to dig into this because I don't use that plugin. Site Admin > EXIF/IPTC

I hit that already, I thought I mentioned that in the first post. There is no option in that to translate the caption to the TITLE. Despite what the FAQ says.

Edit: The option specifically says

"When photos are added to Gallery check for IPTC Object Name and apply to: "

I'm looking to get the IPTC CAPTION in the title, not the object name.

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Tue, 2009-08-04 23:42

Ah, digging a bit deeper, you'll need to hack the EXIF plugin code yourself for that.

The IPTC spec states that the caption can contain up to 2000 characters. That makes for a very long title.

http://www.iptc.org/cms/site/index.html;jsessionid=aucW1spzAOfa?channel=CH0134
Formatting lost from copy-n-paste

Quote:
Caption/
Abstract
Not repeatable, maximum of 2000 octets, consisting of graphic
characters plus carriage-returns, linefeeds and spaces.
A textual description of the objectdata, particularly used where
the object is not text.

I don't see anywhere on the EXIF plugin page that it specifically states putting the caption into the title. If I get the time, I'll clarify that page to match what the settings for the plugin under Site Admin actually states.

____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
Joe Siegler
Joe Siegler's picture

Joined: 2005-09-14
Posts: 54
Posted: Tue, 2009-08-04 23:53
Quote:
Ah, digging a bit deeper, you'll need to hack the EXIF plugin code yourself for that.

Is there any help on how to do that?

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Wed, 2009-08-05 00:02

Do what I do and start reading and searching through the code. It's at /modules/exif

grep -nri objectname ./

appears to show that ExifDescriptionOption.inc is where the title is set from the IPTC.ObjectName

I'm sure you'll need to touch other files under that plugin as well.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
steve-p

Joined: 2007-04-26
Posts: 8
Posted: Sun, 2010-01-17 12:51
Joe Siegler wrote:
Quote:
Ah, digging a bit deeper, you'll need to hack the EXIF plugin code yourself for that.

Is there any help on how to do that?

Maybe a bit late for you, but it might help someone else and I needed to do this today. My requirement was very simple - just to copy the IPTC caption into the Title field and not mess with anything else. The changes are minimal and only in modules/exif/ExifDescriptionOption.inc:

To force it to always process the EXIF block I changed this:

    /* Check if we need to get/process any exifdata */

to this:

    /* Check if we need to get/process any exifdata */
    /* Overwrite default to always look for IPTC Caption - SP */
    $needed[] = 'IPTC/Caption';

To always store the caption if it has been extracted I changed this:

    if (!empty($itemDescription)) {
        if ($addOption & EXIF_ITEM_SUMMARY) {
            $currentItems[$i]->setSummary($itemDescription);
        }
        if ($addOption & EXIF_ITEM_DESCRIPTION) {
            $currentItems[$i]->setDescription($itemDescription);
        }
    }

to this:

    if (!empty($itemDescription)) {
        if ($addOption & EXIF_ITEM_SUMMARY) {
            $currentItems[$i]->setSummary($itemDescription);
        }
        if ($addOption & EXIF_ITEM_DESCRIPTION) {
            $currentItems[$i]->setDescription($itemDescription);
        }
        /* Always copy item description into title - SP */
        $currentItems[$i]->setTitle($itemDescription);
    }

This is very much a quick and dirty solution, but it works for me. Hopefully someone will do it properly one day :)