IPTC/EXIF and Keywords

dankajh

Joined: 2005-11-11
Posts: 3
Posted: Fri, 2005-11-11 11:16

Sorry about my english :(
My aim would be to be able to modify the tags EXIF/IPTC of the photos across G2. For this, I have been reading these two threads:
http://gallery.menalto.com/node/29607
http://gallery.menalto.com/node/38737
The two are related to the topic of the tags EXIF/IPTC, but I see that there are several ideas that I have not still had very clear. Probably with help of the developers, we might detach a series of targets and the steps to be able to implement them.
To help to define these aims, the following questions happen to me:
a. If a photo has tags EXIF/IPTC:
1. Do we want that all tags EXIF/IPTC would be stored in the DB or only some?
2. How would they be stored in the BD?, would new tables be created?, would add to themselves new fields in tables already existing (which?)?
3. How would integrate into the DB the existing information of G2 (commentary, title, keywords) with the tags EXIF/IPTC?, would be stored separately or would the tags and similar fields be unified?, if they are unified, would the tags of the photo be modified also so that it remains reflected in this one?
4. How would the searches be made?, would there exists possibility of looking based on values of all the types of tags EXIF/IPTC?, just as in previous point, how would be related the searches of tags to the G2?

b. If a photo does not have tags EXIF/IPTC:
1. Do we want that they can be added?, do we want that automaticaly the data of G2 (comment, title, ...) would be added in the similar tags of the photo?

Well, the truth is that I do not know if I have explained it well, but it would be good that the same questions someone can divide them in mas clearer targets.
My idea is that it is possible to allow everything previous and that is the user the one that can choose what to keey and how to search.
After the aims have remained clearer, I would like that someone could explain a series of steps to carry out them, as the files that it is necessary to modify and in what order.
Would it be possible?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Fri, 2005-11-11 13:21

a new g2 developer, ColoredPixels, is already working on an improvement of the exif module.
he adds exif write capability to the module (but it requires perl right now) and we'll see what else can be done.

a.1. yes, certainly. but someone has to step up and write the change. all/just some: doesn't matter, small difference. we can offer a GUI to let the user choose which tags to store.
a.2. yes, it requires a new table. this has been discussed in another forum topic.
a.3. separately. we can add options to copy the exif keywords / comments / .. to the Item table and the other way around. right now, the exif/iptc caption / description / keywords are already imported into the Item table when you add an image to g2
a.4. the exif module would have to implement the g2 searchInterface and we could add options to only search in specfic tags or in all tags

b.1. the new exif module will have write capabilities to write exif into images that didn't have exif tags before.

 
dankajh

Joined: 2005-11-11
Posts: 3
Posted: Fri, 2005-11-11 16:08

Would it be possible to view and participate in the improvemente of this module?

 
drhiii

Joined: 2003-04-27
Posts: 397
Posted: Fri, 2005-11-11 20:36

This is great news, of this possibility. But did I read the last one correctly, that "the new exif module will have write capabilities to write exif into images that didn't have exif tags before"? This is quite cool if yes...

Anyway way to participate in this?

valiant wrote:
a new g2 developer, ColoredPixels, is already working on an improvement of the exif module.
he adds exif write capability to the module (but it requires perl right now) and we'll see what else can be done.

a.1. yes, certainly. but someone has to step up and write the change. all/just some: doesn't matter, small difference. we can offer a GUI to let the user choose which tags to store.
a.2. yes, it requires a new table. this has been discussed in another forum topic.
a.3. separately. we can add options to copy the exif keywords / comments / .. to the Item table and the other way around. right now, the exif/iptc caption / description / keywords are already imported into the Item table when you add an image to g2
a.4. the exif module would have to implement the g2 searchInterface and we could add options to only search in specfic tags or in all tags

b.1. the new exif module will have write capabilities to write exif into images that didn't have exif tags before.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sat, 2005-11-12 00:58

as I see it, ColoredPixels will most probably cover the read/write exif module extension (multiple libs can be used, not just the current php based library which can only read, and is not very reliable at that). we'll see.

of course you can add suggestions. e.g. if you find a php based exif/iptc library that can read and write exif / iptc and is reliable, that would be great.

i'd welcome any help in extending the exif module to make exif / iptc tags searchable:
- as explained on the first page of this thread, we need a db Map table to hold the itemId, tagName, value mappings
- then we need an implementation of the SearchInterface_1_0 (see comment/module.inc performFactoryRegistration)
- and maybe admin options to define which fields are searchable
- and we could offer an itemeditoption to copy data from exif to the item (and later also the other way around)
- and maybe a maintenance task to do this for all items at once

 
Termitenshort
Termitenshort's picture

Joined: 2005-10-09
Posts: 1894
Posted: Sun, 2005-11-13 16:04

Hello !

Would it be possible to extend the module to gather GPS information ?
I'm currently part of a team of people to extend the Google map module and we just made a quick and dirty api to get those same informatino using the php_exif library (<- not good)

It would be nice for us if we could get GPS coordinate using the EXIF module via a function like getGPScoord($id) or something that would return it in the format longitude,latitude :-)

Thanks in advance :-)
-------------------------
The Termite :-)

 
drhiii

Joined: 2003-04-27
Posts: 397
Posted: Mon, 2005-11-14 07:36

All sounds quite excellent. Will poke around for an iptc lib to do as you suggest.

Another feature that extends beyond the searchable exif fields would be to extract from the EXIF and create or populate the description fields for G2, and for all the search engine bots that tear through sites looking for this meta information.

valiant wrote:
as I see it, ColoredPixels will most probably cover the read/write exif module extension (multiple libs can be used, not just the current php based library which can only read, and is not very reliable at that). we'll see.

of course you can add suggestions. e.g. if you find a php based exif/iptc library that can read and write exif / iptc and is reliable, that would be great.

i'd welcome any help in extending the exif module to make exif / iptc tags searchable:
- as explained on the first page of this thread, we need a db Map table to hold the itemId, tagName, value mappings
- then we need an implementation of the SearchInterface_1_0 (see comment/module.inc performFactoryRegistration)
- and maybe admin options to define which fields are searchable
- and we could offer an itemeditoption to copy data from exif to the item (and later also the other way around)
- and maybe a maintenance task to do this for all items at once

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2005-11-14 13:28

we already exract the description from iptc into the item description at upload time. but this sure could be extended.

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Mon, 2005-11-14 15:49

Termitenshort, there already is an interface in exif module that may help.. you can use it like this:

    list ($ret, $exif) = GalleryCoreApi::newFactoryInstance('ExifInterface_1_0');
    if ($ret->isError()) {
        return array($ret->wrap(__FILE__, __LINE__), null, null);
    }
    if (isset($exif)) {
        list ($ret, $exifData) = $exif->getMetaData($itemIds);
        if ($ret->isError()) {
            return array($ret->wrap(__FILE__, __LINE__), null, null);
        }
    }

See phpdoc in modules/exif/classes/ExifInterface_1_0.class

 
Termitenshort
Termitenshort's picture

Joined: 2005-10-09
Posts: 1894
Posted: Mon, 2005-11-14 16:26
mindless wrote:
Termitenshort, there already is an interface in exif module that may help.. you can use it like this:

    list ($ret, $exif) = GalleryCoreApi::newFactoryInstance('ExifInterface_1_0');
    if ($ret->isError()) {
        return array($ret->wrap(__FILE__, __LINE__), null, null);
    }
    if (isset($exif)) {
        list ($ret, $exifData) = $exif->getMetaData($itemIds);
        if ($ret->isError()) {
            return array($ret->wrap(__FILE__, __LINE__), null, null);
        }
    }

See phpdoc in modules/exif/classes/ExifInterface_1_0.class

Great thanks ! Is this interface gathering the GPS data ? I thought that the module included with gallery 2.0.1 did not have it.

I will check.

THanks a lot !
--------------------------
The Termite :-)

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Mon, 2005-11-14 16:27

The interface just returns the gathered exif data.. not sure if GPS is included in that.

 
Termitenshort
Termitenshort's picture

Joined: 2005-10-09
Posts: 1894
Posted: Mon, 2005-11-14 16:37

Snif, I have checked and for some reason the EXIF module does not gather the GPS information :(

Is there an easy way to get the additional parameters ?

Thanks
-------------------------
The Termite :-)

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2005-11-14 16:51

exifTool (perl) (http://www.sno.phy.queensu.ca/~phil/exiftool/) supports the GPS extension of exif. coloredpixels is looking into this lib mostly because of its write capabilities.
don't know if it's specific to exifTools, but there the GPS data is stored in a separate IFD, see http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/GPS.html

according to http://www.jakeo.com/software/exif/index.php
our exifer 1.4 already has GPS parsing capability (v1.3, we've got 1.4)

so we just need to know where to look for it.

Termitenshort
did you copy exif/classes/ExifExtractor.class as an example?
i'd start by outputting all exif raw data and then check what IDF / key you need.

 
Termitenshort
Termitenshort's picture

Joined: 2005-10-09
Posts: 1894
Posted: Mon, 2005-11-14 17:04
valiant wrote:
exifTool (perl) (http://www.sno.phy.queensu.ca/~phil/exiftool/) supports the GPS extension of exif. coloredpixels is looking into this lib mostly because of its write capabilities.
don't know if it's specific to exifTools, but there the GPS data is stored in a separate IFD, see http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/GPS.html

Yes GPS data is stored in a different IFD, the "dirty hack" I made was extracting it via exif_read_data of php

valiant wrote:
according to http://www.jakeo.com/software/exif/index.php
our exifer 1.4 already has GPS parsing capability (v1.3, we've got 1.4)

so we just need to know where to look for it.

Termitenshort
did you copy exif/classes/ExifExtractor.class as an example?

No I have not tried that but I used the example above and output the all deal to a simple PHP page and couldn't see the GPS data.

I also took a look at ExifHelper.class but I could not see any references to the GPS information, maybe I'm not looking in the right place ?

Thanks
-------------------
The Termite :)

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2005-11-14 17:08

please link to an jpeg with gps exif data.

 
Termitenshort
Termitenshort's picture

Joined: 2005-10-09
Posts: 1894
Posted: Mon, 2005-11-14 17:30
valiant wrote:
please link to an jpeg with gps exif data.

Here you go: http://termite.responsiveweb.com/gallery2/v/random/creamers.jpg.html?g2_navId=x4aad5203

This is test website :-)

 
Termitenshort
Termitenshort's picture

Joined: 2005-10-09
Posts: 1894
Posted: Mon, 2005-11-14 18:07

I got it !!

I've added this

	$data['GPS/Latitude'] =
	    array($gallery->i18n('GPS/Latitude'), 'GPS.Latitude');

To the exifhelper.class and I got the EXIF module to display the GPS coordinate (At least the latitude) :D

I guess I need to modify the EXIF-module slightly (i hope it's not a big deal ?)

-------------------------
The Termite :-)

 
Termitenshort
Termitenshort's picture

Joined: 2005-10-09
Posts: 1894
Posted: Mon, 2005-11-14 18:11

I guess I got excited to quickly ... Indeed I've got latitude and longitude but I cannot get the "reference" -> which makes my finding pretty useless :(

1 step forward 2 steps back ...
-------------------------
The Termite :-)

 
Termitenshort
Termitenshort's picture

Joined: 2005-10-09
Posts: 1894
Posted: Mon, 2005-11-14 18:15

Allright ... fumbled a bit more (in the last few sec ...) and I found that this works:

	$data['GPS/Latitude'] =
	    array($gallery->i18n('GPS/Latitude'), 'GPS.Latitude');
	$data['GPS/Longitude'] =
	    array($gallery->i18n('GPS/Longitude'), 'GPS.Longitude');
	$data['GPS/LatitudeRef'] =
	    array($gallery->i18n('GPS/Latitude Reference'), 'GPS.Latitude Reference');
	$data['GPS/LongitudeRef'] =
	    array($gallery->i18n('GPS/Longitude Reference'), 'GPS.Longitude Reference');

BUT i don't know how to format this :(. when i use the EXIFER thing lat.lon shows up as a decimal number (which is what I want) but when I do what's above I get dgree,minute,second....

Do you know how to format the output using the exifer library ?

Thanks in advance
-------------------------
The Termite :-)

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2005-11-14 18:37

ok, seems you already found out that you can get it that way.
i've just checked if the output is there when you use exifer 1.4 (what we use in the exif module) with:
$data = read_exif_data_raw($path, false);
var_dump($data);
if (isset($data['GPS'])) {
var_dump($data['GPS']);
}

and you get the GPS data for the image.
seems like our function getExifKeys() { doesn't list everything, don't know why.
everything that is lised in exif/lib/exifer/makers/gps.inc is available.

@format:
$data[GPS] has the following format:
["Latitude"]=>
string(11) "64 51 51.42"
which is degree, minute, seconds . what format do you need?

 
Termitenshort
Termitenshort's picture

Joined: 2005-10-09
Posts: 1894
Posted: Mon, 2005-11-14 20:01
valiant wrote:
@format:
$data[GPS] has the following format:
["Latitude"]=>
string(11) "64 51 51.42"
which is degree, minute, seconds . what format do you need?

Well I wanted to have just a number. google is expecting a decimal xxx.xxxxxxxxxx for longitude and latitude. I made a dirty formula that transform the degree, etc to decimal but I know exifer can do it so i'd rather use the builtin function if possible :)

Thanks for the quick reply :)

Otherwise, is it ok if I modify the EXIF module or someone else should be doing it ?
If it's ok, should I make another version for people to download and upgrade ? (i that's the case I would add all of the GPS information in of course)

--------------------------
The Termite :-)

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2005-11-14 23:48

hmm, i don't know the GPS formatting related features of exifer.

i've now added all fields from exifer/makers/gps.inc to ExifHelper.class (not yet committed). see: http://dev.nei.ch/exifhelper_gps_diff.txt
it will be in soon, unless mindless is against it :)

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Tue, 2005-11-15 00:11

ok, added the whole 31 keys. available in tomorrows nightly snapshot of G2.
note: sf.net anonymous cvs is still badly out of sync, state of Friday morning.

 
Termitenshort
Termitenshort's picture

Joined: 2005-10-09
Posts: 1894
Posted: Tue, 2005-11-15 05:47
valiant wrote:
ok, added the whole 31 keys. available in tomorrows nightly snapshot of G2.
note: sf.net anonymous cvs is still badly out of sync, state of Friday morning.

NIICE ! Thanks a lot for this update it's gonna simplify the Map-module quite a bit for all exif related things :D

thx a lot

 
njacobs

Joined: 2003-10-06
Posts: 10
Posted: Sun, 2006-02-12 15:50

Valiant,

is the exif write module still being worked on? I would like to write copyright info to my pictures. coloredpixels should be working on it but I have no idea where to see the status of his work

regards

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Mon, 2006-02-13 02:36

we discussed some ideas a while back, but i haven't seen any progress on it.

 
jcampbell1

Joined: 2005-10-26
Posts: 8
Posted: Wed, 2006-02-15 06:02

There is a PHP Library that can write EXIF data located at http://pel.sourceforge.net/ . A problem is that it requires PHP5, and it is still beta. I have been playing around with it, I can sucessfully edit/add EXIF data, but I am not familiar enough with the gallery API to create a module.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Tue, 2006-02-21 23:25

anyone interested in improving this module, please check out:
http://codex.gallery2.org/index.php/Gallery2:Modules:exif:Development

and let's coordinate who's doing what. we'll gladly guide you if you have questions or need help understanding the G2 API.

 
joe7rocks
joe7rocks's picture

Joined: 2004-10-07
Posts: 560
Posted: Sun, 2006-03-26 04:10

Just a quick note:
i've just added 'basic' database features to the current (as of release of G 2.1.0) version of exif module:
- admins can set in moduleconfig what exifProperties to store in the database
- it gets automatically stored on itemUpload
- all the storen data is searchable from the general search interface

it needs some additional steps, maybe finetune too, then i'll 'release' it here as it is.