Hello,
I started to develop an EXIF module for Drupal 6. This module would come woth Image module.
From now, my module only displays a "Show EXIF" button on each image node, and clicking on this button makes an AJAX call to display EXIF data (at the moment, it is only a raw array data).
I am planning to add a configuration page, where administrator can choose which EXIF data to display.
Reading IPTC data can eventually be done.

I use PHP's EXIF extension, so you only need to activate it in php.ini (no need for PEL).

To EXIF maintainer: please tell me if you are working on a Drupal 6 port, and if my work interests you.

You can get an alpha version of my work in attachment.

Any thoughts or questions are welcome. :)

Regards,
David

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

David Stosik’s picture

FileSize
797 bytes

Woops, I think I forgot the attachment. :D

David Lesieur’s picture

I did not check your module yet, but from your description I understand that it is a complete rewrite of the existing module, with a different feature set (added AJAX goodies; provided no way to select what Exif data to show — IMO, losing the latter would be unacceptable to current users of the Exif module). To fully replace the existing module, you'd have to explain a little bit why it deserves to be ditched. ;-) If it does not deserves to be ditched, then the ideal process would probably be to take the best from the existing module, the best from yours, and join forces through the usual review process, small feature by small feature, to get an ever better module. Does that sounds good?

David Stosik’s picture

Status: Needs work » Active
FileSize
782 bytes

Hello,
This is actually a complete rewrite, more a proof of concept than a real module. :)
I started to develop this yesterday, then I realized an EXIF module was already existing. So, Before publishing my module, I chose to post this issue.
We can indeed join forces into developing a Drupal 6 version of your EXIF module, but I have some, well, "requirements". :)

  • first, I think we should get rid of PEL, as it is a obstacle to people wishing to use the module, and who don't want to (or can't) add external libraries to their Drupal installation
  • user should decide whether to view or not the EXIF information, as these data don't talk to everyone, and make eventually unneeded data loading, and I think AJAX is a good way to implement this

Please have a try to my little work and tell me what you think of it. :)
I attached a slightly debugged version.

Regards, David

David Stosik’s picture

Status: Active » Needs work
FileSize
10.35 KB

Hello again. :)
I ported your module to Drupal 6 quickly, and added AJAX system. PEL is still present, but I would like to know your (and users') point on getting rid of it.
Could you tell me what do you think of it?
I know it still needs commenting, a little bit theming, and cleaning, but it works. :)

Again, any thoughts are welcome.

Regards,
David

David Lesieur’s picture

Status: Active » Needs work

Thanks for the quick update! I did not review your work yet... (Btw, if you can provide patches, it will make the reviewing process less tedious).

Regarding PEL, I'm not too convinced about getting rid of it. If you can install the Exif module, then you can also install PEL. AFAIK, the only obstacle with PEL is the requirement for PHP 5, but then I'd say we should jump with the GoPHP5 movement anyways. I'm not too interested in reinventing the wheel and reimplementing everything PEL already implements, and then having to maintain that code base. Note that PEL also supports writing Exif data, which could open the door to interesting applications where images could be fully managed under a Drupal system.

If other users/developers have opinions on this subject, please share!

Other than that, I'll be happy to integrate a D6 port, and/or improvements/new features to the module. Ideally, these should be submitted as separate patches, since these are separate issues. Say one new feature is not really ready to be committed, while the D6 port is, then if both are in the same patch, both get delayed until the new feature is fixed...

I'll try to review this as soon as possible.

David Stosik’s picture

I'll try to provide you with patches. ;)

David Stosik’s picture

FileSize
5.28 KB

First patch: the Drupal 6 port. :P

David Stosik’s picture

FileSize
6.19 KB

Second patch: make an AJAX call on a button click to retrieve EXIF information.
This one needs previous patch to be applied before.

David Stosik’s picture

Status: Needs work » Needs review

Any news?
David, have you been able to test my patches?

David Stosik’s picture

Title: Develop a Drupal 6 version, without PEL need » Drupal 6 version | Displaying EXIF data with AJAX
wildtang3nt’s picture

I cant seem to get your patches to apply. Can you describe in detail how you did them? I keep getting errors.

David Stosik’s picture

I used diff -up command.
Could you tell me what are the errors you get?
I diffed exif.old/exif.module with exif/exif.module ...

Regards,
David

wanderingstan’s picture

My 2 cents:

EXIF should eventually be a bundled sub-module of the Image module, in much the same way that Image Gallery is.

If the PEL requirement can't be removed, then it would be best to include a working version of it.

For any dependencies (PEL) or otherwise, the module should detect if it can run, and show an intelligent "I can't run because I'm missing dependencies" message rather than the PHP errors that are now generated.

I'm a developer working on a startup that will need the EXIF module, and would love to get involved with extending it. How can I best help?

David Lesieur’s picture

@wanderingstan: Your points are worth discussing but off-topic... Please post each topic to a separate issue.

David Stosik’s picture

David, could you tell me if you will include my patches?

David Lesieur’s picture

Status: Needs review » Needs work

@sto: Unfortunately, the patch does not apply. According to the patch file, your original files were dated August 13. It looks like you have worked from the last release, but updates have been made to the module since then (although no release has been published yet). Make sure to start from latest version, either through CVS or from the latest snapshot release.

Other than that, the patch looked clean... If it applied, it could have been approved!

macsim-1’s picture

FileSize
617.41 KB

Hello,
take a look on my exif module, it will work on your drupal 6.x
I've just update the past version with same fonctionalities except the possibility of a class added to the table display of the exif's infos

Sorry for my bad english,
I am from French.

David Lesieur’s picture

Could you provide a patch? It would make reviewing much easier.
Thanks.

David Stosik’s picture

Hello,
Sorry for the long time not answering...
Here is a 5 to 6 patch applying to HEAD.
Hope it gets applied and comitted before current HEAD gets obsolete. ;)
I think this first issue becomes critical, as Drupal 6 becomes the version to start with. :)

Regards,
David

David Stosik’s picture

Priority: Normal » Critical
Status: Needs work » Needs review

I really thought I attached my patch. :D

David Stosik’s picture

David Stosik’s picture

Wow, sorry for the multiple posts, but I am having a problem here... Maybe there's a probleme when uploading a file starting with a number. I'll try to rename it.
Edit: Very sorryfor the multiple posts, I realize I could have use the Edit function...
As I can't seem to upload my file to drupal.org, here is another URL:
path to EXIF 5 to 6 patch

Edit2:
And here is the AJAX patch, applying on previously patched code.
path to EXIF AJAX patch

David Stosik’s picture

Hello,
Any news?

David Lesieur’s picture

Unfortunately, I did not have time to review the patch yet, and I won't be able to this week. :(
In the meantime, other interested parties are encouraged to test, review, and report back!

David Lesieur’s picture

Title: Drupal 6 version | Displaying EXIF data with AJAX » Drupal 6 version
Status: Needs review » Needs work

I have tested the patch. It seems to basically work, but any changes to the settings are never saved (this is caused by argument changes in D6 on form submit handlers).

I have tested only the Drupal 6 port at this point. Let's focus on Drupal 6 here and post the Ajax stuff to a separate issue, to make it easier to follow things up. Thanks!

meba’s picture

The patch is not available anymore on that URL. Anybody having it so I can review it and update ?

David Lesieur’s picture

FileSize
6.8 KB

I have found a copy sto's patch (from #22) that was still lying around on my disk. It did not magically fix itself though and still needs work. :-)

aries’s picture

FileSize
6.41 KB

Here's the version of mine. Works for me.

AntiNSA’s picture

subscribe

AntiNSA’s picture

Can you tell me will this embed the keywords into the database and make them searchable for drupal, like with gallery2?

metabits’s picture

Assigned: David Stosik » Unassigned
Category: task » feature
Priority: Critical » Normal
Status: Needs work » Active

is anybody working on IPTC fields? caption, keywords and some other iptcs standards are more important to me than info about camera, iso, shutter speed and so on.

thanks anyway for your job!

psc

rapsli’s picture

working on it... going to create a D6 Branch within the next days.
@david: Is that ok?

rapsli’s picture

Going to rewrite this module, as I need it for a project.

- Features are going to be cCK integration, meaning the user can create a cck field (e.g. exif_model), which would then save the model exif tag for this node type. This allows full views integration plus the user can edit the exif data. The admin/settings/exif page would disappear as a result of this.

- I'm not going to use the exif library anymore.

- PHP5 only.

- imagefield support

@David. Is this ok with you?

wanderingstan’s picture

I would love to help with coding with this if needed.

- I love the idea of having associations between CCK fields and EXIF fields, with synchronization between the node field and the image metadata fields. If it was as simple as creating a CCK field named "exif_model", that would be amazing.

- Along with the earlier commenter, I would like to see the module support other metadata formats beyond EXIF -- IPTC and XMP in particular. ExifTools has a complete list of metadata tags that could in theory be supported.

rapsli’s picture

Since I'm not going to use the previously used library for exif it should not be a problem to support other formats. I'm gonna start tomorrow setting up a frame, where we can program in. Let's look on monday how we can split up the work, when we got some code in it.

As architecture I see the following:
exif.module -> drupal integration
exif.class.php -> a class containing all exif reading and processing (meaning .module only contains hook implementations)

AntiNSA’s picture

If you can make sure the keyword characters allow more than 255 characters, like at least 1000 or more that would be great.. and make them fully searchable and cck them....

jamesJonas’s picture

"I would like to see the module support other metadata formats beyond EXIF -- IPTC and XMP in particular" - XMP is a great suggestion. Thx

jamesJonas’s picture

Sample XMP extraction using PHP. This may be a too specialized case, but it is informative.

http://photography-on-the.net/ee/beta/cs_xmp_to_exif.php

David Lesieur’s picture

Btw, I have never really looked at the code, but Feed Element Mapper might give some ideas or even reusable code for mapping data to taxonomy, CCK, or other types of fields. Even if there were no readily reusable code in there, perhaps there is an opportunity to join forces and create a generic framework for mapping data sources to fields.

rapsli’s picture

as promised a first version: http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/exif/?pathr...

tested it on two sites. I think there are some problems with the install?! Other than that it works very great! Awesome to integrate with CCK and the code is extremely simple and short.

@david: Is this oky, if I create a first alpha version of it for D6, so we get more people testing it.

David Lesieur’s picture

@rapsli: Awesome! I have just created a snapshot release. It should get generated within the next few hours.
As this is a whole new codebase, I think it would be safer to gather some feedback on a dev version before releasing an alpha.

Unfortunately I did not have time to really review your work, but some quick suggestions:

  • Validate the code through Coder.
  • Most of the code on drupal.org being a collective work, it is usually best to avoid stating authorship on the code. That can be deterrent to collaboration. The CVS history allows one to find all the authors of the work. I'm adding your name to the project's page though.
David Lesieur’s picture

Status: Active » Needs work
TechDust’s picture

@rapsli

I love to have this, but I'm a bit confused on how t install and test it.

All I want is the ability to display EXIF data (say, Camera, Aperture, speed, iso,...) along with an image (uploaded using ImageCache).

I'm trying to only use imagecache/imagefield rather than the Image module.

thanks in advance

rapsli’s picture

have you read the readme?? It should work just fine with imagefield. If not, let me know.

TechDust’s picture

wow.... thanks for the quick response

I'm using drupal 6, php5, the dev6 of the module. I get the following error:

when I go to the site config > exif
I get the error, without any other option

* warning: read_exif_data() [function.read-exif-data]: Unable to open file in /www/sitename/sites/all/modules/exif/exif.module on line 112.
* warning: Invalid argument supplied for foreach() in /www/sitename/sites/all/modules/exif/exif.module on line 117.

thanks again

robert.oconnell’s picture

I encountered the same problem.
Tracing through the code, I discovered my problem was that the node type containing my CCK-based image is "image". This apparently is the special node type name for the image module, which this module uses a different technique to find the file's path.

So, obviously one solution is to use a different node type name.

Lacking that on a "published" site, I'm not sure how to continue to use the module as is. I'll be modifying my site's module to comment out the following in exif.module:

function _exif_get_image_path($fields,&$node){
/*	if($node->type == 'image'){
		return $node->images[IMAGE_ORIGINAL];
	}
*/
	foreach ($fields as $field) {
  ...
dman’s picture

Hello guys.
an off-topic cross-reference to a metadata merger for images that I'm playing with
I approached the problem from the other end.
I wanted to fill in titles and descriptions on files when importing them in bulk, so used a text file and hooked into image_import.
Then I saw I could tag them with keywords as well. Then figured I could add any metadata I find. And tried to find a way for metadata applied from Drupal to go back into the images for posterity.
So went looking for metadata methods and started using XMP. And EXIF also.
So got an EXIF reader library to support my metadata-onto-image-nodes process.
... and end up wondering if the EXIF.module has any of the same goals in mind. A look at the code available today looks useful?

[edit] fixed links

David Lesieur’s picture

Btw: The above link is broken but got it: #256195: Enhance image_import by allowing submitter to provide captions (plus a general-case solution)

One of the reasons for which I had initially chosen the PEL library (for the D5 version of exif.module) was its ability to not only read Exif data, but also write it. Read-write capabilities were a goal, although the current version of the Exif module is light-years from it!

Although I have not tried your code, it looks like a merger could make sense. However, I have too little time at the moment to help design a solution. I'll be happy to grant you CVS commit access if you'd like to step forward.

Some of my personal goals for metadata that come to mind:

  • Ability to map metadata to taxonomy and CCK fields.
  • Read-write support for metadata.
  • Support for Image and Imagefield (ideally in a generic enough way, to allow support of other media types).

Then the name "Exif" might be a bit limiting for a module that would do all this. :-)

dman’s picture

fixed links :-}

I'm also keen on the read-write idea. Eventually.
Our discussions in the thread are tending towards a generic file-metadata-hook-naming scheme. EXIF is certainly ONE of those.
Investigation has shown that the actual EXIF labels (never mind labels available to other media types) is all over the place, so mapping is certainly going to become important at some point.
Me, I'd like if RDF-in-core allows us to add arbitrary tags, but I guess for better Drupal integration a CCK and taxonomy compatible approach is the place to start.
Just the mapping UI is a bore to build and admin...

I've only worked with image.module nodes so far, but I realize the imagefield is the way of the future. Next time I pick up the job (not really active right now here either) I'll ping you back with suggestions on the API we can cooperate on.

geerlingguy’s picture

Subscribe.

radj’s picture

Every photographer-slash-Drupal-developer's dream module. lol.

radj’s picture

Every photographer-slash-Drupal-developer's dream module. lol. Subscribing! :)

chachasikes’s picture

FileSize
601 bytes

I had a problem with exif not reading iptc multiple keywords properly. It was only reading the first keyword into my cck textfield (field_iptc_keywords)

in exif.module line there is an innerkey concatenator -- i added this to exif.class.php and now it concatenates the terms into the single field.

see attached patch

chachasikes’s picture

oh whoops - sorry - the previous patch is applied to the dev version (current head doesn't have exif.class.php)
it can be found here: http://drupal.org/node/598558

rapsli’s picture

Status: Needs work » Fixed

committed to head

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

design10’s picture

Category: feature » bug
Priority: Normal » Minor
Status: Closed (fixed) » Active

Imagefield has been turned into a widget for filefield. This mod does not work if you use a more recent version of imagefield.

rapsli’s picture

Status: Active » Closed (fixed)

let's keep this closed... just tested it and it seems to work just fine.