This patch provides initial XMP metadata retrieval support using XMP Toolkit PHP Extension.

  • While this patch makes the toolkit a requirement for the module, it could be easily changed to retrieve XMP fields just in case the toolkit is available.
  • Following the convention adopted in the exif module, XMP fields should be mapped into CCK using the field_xmp_ prefix, like field_xmp_headline.
  • Contrary to EXIF and IPTC Legacy (IIM) fields, XMP uses RDF and thus uses XML namespaces. Then, a mapping is needed between a CCK field name and a XMP property which depends in a namespace. Also, XMP uses datatypes such as structures and arrays that should be taken into account.
  • Not all well known XMP fields were included at Exif::getXMPFields() but they can be easily added into the array that the function returns.
  • Other implementations for XMP retrieval could be used such as Image_JpegXmpReader or even but the one that seemed more mature, well integrated and in active development is XMP Toolkit PHP (see a list of possible implementations).

This patch is the initial work of making a mass import of images into a drupal website so that means new code can arise in the short term. This initial patch is being submitted here for review and possible inclusion into the exif module tree.

Comments

silvio’s picture

StatusFileSize
new8.32 KB
rapsli’s picture

Hi there
Looks great. Thanks for the work. I think I might modify the code a little bit, just to better split it up, so it's better maintainable. It would be really great if you could write the code in a matter so this library isn't needed, as there might be a lot of people who don't have it, which will then lead to issues in the issue queue.

rapsli’s picture

btw. do you have an XMP image? So I can test it on my machine?

rapsli’s picture

Status: Patch (to be ported) » Needs work

Looked at it. Looks fine to me. I made the XMP not a requirement for the module.
committed to head.

It would be nice if the XMP information would be included in the admin part: function exif_admin_settings()

silvio’s picture

StatusFileSize
new4.74 KB

Hi, thanks for the quick reply :)

I just made some more changes and here comes a new patch (this one is incremental and may be applied directly atop of the changes you just commited). The patch basically introduces some error handling and new XMP metada fields.

I'm looking forward to provide some sample image, update exif_admin_settings() and also to not depend in the XMP PHP Toolkit.

rapsli’s picture

I actually already built that in (that it doesn't depend on the XMP Toolkit)

rapsli’s picture

let me get the changes of exif_admin_settings() into the module

rapsli’s picture

Status: Needs work » Fixed

applied patch

Status: Fixed » Closed (fixed)

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

silvio’s picture

Status: Closed (fixed) » Needs review
StatusFileSize
new156.88 KB

Sorry for the long delay... :/

Here goes a sample image loaded with XMP metadata available for testing purposes.

I was looking for pure-PHP XMP libraries but so far I just found very outdated/unmaintained (like The PHP JPEG Metadata Toolkit) or too simple/incomplete (like Image_JpegXmpReader, ee_extract_exif_from_pscs_xmp and some snippets). At the Creative Commons XMP page there's a mention to a xmp/php-jpeg module but I can't find it.

So currently I just see XMP Toolkit PHP Extension as a viable implementation.

Development of this feature is being supported by Cinemateca Brasileira (Brazilian Film Museum).

joeysantiago’s picture

StatusFileSize
new3.92 KB

Well, since i didn't have php 5.3 on my server, i wrote a small module taking some ideas and code from exif in order to use xmp metadata to populate tag taxonomies.

here's the rough code that i used with imagefield_import to import images from a folder.

hope it can be useful! :)

joeysantiago’s picture

StatusFileSize
new6.48 KB

Helo...

i added support for a second taxonomy where to put author's data.

there's then an admin page where you're asked to set up the two taxonomies ids.

silvio’s picture

I haven't time to review and test this patch, but maybe it could be integrated in the existing exif module as an alternative to XMP Toolkit PHP Extension.

jphautin’s picture

Issue summary: View changes
Status: Needs review » Closed (won't fix)