Closed (fixed)
Project:
Exif
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
16 Jan 2007 at 23:03 UTC
Updated:
23 Sep 2007 at 07:11 UTC
Jump to comment: Most recent file
Comments
Comment #1
David Lesieur commentedI'd like to add this functionality at some point, although I can't promise any time frame. Of course I'll be pleased if anyone contributed code. ;-)
As for the integration with taxonomy, it is certainly a goal here, both for Exif and IPTC. Right now, metadata is extracted each time the image is displayed. Instead, I'd like to extract it when the image is submitted, and store it as taxonomy (at least some tags should become taxonomy, not sure yet if they all should).
Comment #2
moshe weitzman commentedif you can believe it, the very first version of image.module had iptc support. see http://cvs.drupal.org/viewcvs/drupal/contributions/modules/image/image.m... ... feel free to copy the code.
Comment #3
fronbow commentedthanks for the reference moshe, I might have to have a look at this soon as I could really do with this feature (I was wondering why it got dropped from image?) for a project I'm working on.
The stock php functions seem easy enough to use (iptcparse and iptcembed) but would prolly need to check if they are in the user's php build.
Before i saw the existence of this project, I was planning to use either the stock php functions or external binaries (exiftool or exiv2) to accomplish this task; does anyone know of any 'manageable' php codebases that do iptc tags? (I know of the PHP Jpeg Metadata Toolkit, but from looking at the code it seems a bit heavy for this, especially if it came to importing a lot of images!)
Comment #4
David Lesieur commentedInteresting... BTW, something I'd like the IPTC library to handle would be reading *and* writing IPTC data. PEL, for instance, can write Exif tags. The Exif module does not use this capability yet, but that's something else I'm thinking about. This way, a Drupal system could become one's main tool for managing and tagging photos... Umm, maybe I should write down some roadmap/ideas I have for this module! ;-)
Comment #5
fronbow commentedWell, I've spent the last week trawling round Gallery2 only to find it doesn't seem to handle iptc tags as such (they're read at view-time but not added to the database :( ) but knowing drupal's use of taxonomy I wanted that facility here!
Some thoughts (as chances are, I might have a go at writing this!)::
From what I've read on php.net, the standard php commands look like they can do read+write tags, though I have read something somewhere about gd2 possibly killing tags in images in certain instances - tho' I could be thinking of something else!
Both exiftool and exiv2 binaries can handle exif and iptc tags, but then it's whether the user's web host can handle this,
The php jpeg metadata toolkit can read a whole range of tags in images, but if you've ever looked at the code it's quite intense!!
It would need an admin page that could perform various tests to see which is the best option for the user (testing executables can be run, testing executables exist, testing the php commands exist, that kind of thing); and likewise some settings for how to handle iptc.keywords and iptc.caption as I was originally thinking the keywords would go into the taxonomy, and the caption would optionally replace the body/description for the image
I might have to have a go at some code over the next few days (I've got a drupal5 test site that really needs iptc handling, not to mention some way of importing images from the filesystem - but that's another problem!!)
Comment #6
David Lesieur commentedExiftool seems pretty nice, but I wonder how widespread it is. It might be difficult or impossible for many users to get it installed on their server, so to me it is a serious issue.
I just had a second look at the PHP Jpeg Metadata Toolkit and now I remember why I chose PEL instead. ;-) Its HTML output functions are certainly useless in the context of Drupal, and I wish those were not thrown in the same files as some core functions... And it looks hard to contribute to the project — unlike PEL, which is on SourceForge. However, it seems possible to build something on top of its basic functions. In fact, the API looks easier to use than PEL's.
Nice puzzle... Each library has its pros and cons. Anyway, I'm looking forward to your work.
Comment #7
fronbow commentedahhh, so it wasn't just me that found the php jpeg metadata toolkit a bit unwieldy then!
I'll have a go later today to see what I can come up with and let you know, (starting off with the stock php functions - tho' not looking forward to going thru' the above toolkit ;)
Comment #8
fronbow commentedI've made quite a bit of progress (but time is still constrained due to work and Real Life(tm) commitments - we've just bought a house).
With the exception of adding keywords to taxonomy (which took a bit of working out) I've got a module that will read the exif and/or iptc tags out of an image. For the moment I'm utilising the exiv2 library, but I plan on adding the option of using pel, php jpeg metadata toolkit, stock php functions, and exiftool (which is still being tested!).
With any luck I'll post something more substantial soon (got a project that depends on this that needs to be live asap!)
Comment #9
fronbow commentedJust as a taster, I've attached a screenshot of the settings page as it stands.
Obviously, the first section is for whichever method you want to use for extracting the keywords/metadata.
Then you can choose whether to get iptc and/or exif; which vocabulary to put the tags in, and whether there's any iptc tags you want to discard.
And finally, whether to overwrite the image body with the iptc caption if it's available.
I'm also hoping to do a cron hook for automation, which would then allow automatic title creation based on an iptc/exif tag or filename.
Comment #10
David Lesieur commentedLook very promising!
Do you intend to carry on the existing feature of selecting Exif tags through a list? It would not be very convenient to have to type more than 100 tags in an exclusion list. ;-)
Comment #11
fronbow commentedMore than likely, just not got round to that bit yet - currently having fun trying to overwrite the node body with the image caption...with no success!
(I've also stumbled across some bits of the php metadata toolkit that just seem to return arrays, which could be interesting)
Comment #12
fronbow commentedUPDATE: my module is currently extracting tags and sticking them in taxonomy...yay! (although it's only using the exiv2 binary cos I haven't got round to hooking in the code for the other libs...boooo!)
I'm just wondering what to do with the exif data?
Comment #13
elv commentedYou could use some fields as default values, in case the IPTC fields are empty.
eg: use the EXIF date if none is set in the IPTC.
Comment #14
fronbow commentedthe EXIF tags are different to the IPTC tags. EXIF is where all the more technical stuff goes (camera make+model, shutter speed, did the flash fire, f-stop, etc). IPTC seems to be where any metadata goes (image title, caption, keywords).
What I'm trying to work out is how to store the exif tags. Do I store them in their own table, or is there a way to store them in some kind of taxonomy (prolly not, as there's quite a lot!)
For the moment I'm storing the raw tags in a table for debugging purposes.
Comment #15
David Lesieur commentedI guess further discussions about IPTC should take place in the IPTC project. ;-)
@fronbow: I hope I'll get some time to try your stuff! Btw, I think it would be great to inject Exif data into the taxonomy, which probably means that some settings would be needed to choose what tags are injected.
Comment #16
(not verified) commented