EXIF/IPTC data writing

I'm wondering if there's a reason the EXIF portion of zenphoto doesn't allow the ability to write the data? Is there some security factor or something that I've missed?

I ask because I've found some php class files that allow the read&write functions of the EXIF data, and was wondering if it was something that should be plug-in'ized or not.

Comments

  • Write data where? We generally do not modify the original image. For cached images (with the 1.4.1 release) we will move as much of the data over as the Graphics library supports.

    Certainly a plugin which updates the original image from the zenphoto database would interest many users.
  • That's kind of what I was thinking. From what I was reading php has the ability to update exif/iptc data.

    What I was thinking is creating a plugin that's similar to "refresh metadata" but works in reverse. Instead of pulling exif/iptc data and populating the database, it adds the info from database to the image.

    The biggest reason for this is gallery management. One of the hurdles I see come up often is "I've moved my data and lost my descriptions" etc. And while there is the backend move function, it's a bit inefficient if you have large amounts of files that you need to move due to reoganization.
  • Take a look at the cacheImage function. It writes IPTC data to the cached image. This is pretty much what can be done with the out of the box GD library. (Imagick does preserve the data automatically.) I suspect that you can get away with just updating IPTC fields (and not EXIF ones) as they pretty much replicate the interesting EXIF data and will override it when Zenphoto consumes the metadata.

    The other source of information will be the image object's updateMedadata() method. There you will see the IPTC tags information.
  • gjr Member
    I think that would be an awesome plugin Micheall - go for it! :) Another reason for it that I have encountered many times is a camera not following the exif/iptc standards, so even if your data is stored in the image file, it will not import correctly into zenphoto. If we had this plugin, we could use it to properly fix/archive the images along with their data using zenphoto.
  • From what I can tell though IPTC doesn't have any image description field. If there's a way to store image descriptions in IPTC fields then that'd be best since php has iptc update ability natively now without relying on any image processing functions.

    Edit: Strike that! I see it does indeed have the description field. This might be a whole lot easier to do via IPTC only for the images.
  • Maybe you could also include a resizing option. Seems that gets asked for a lot.
  • I'll look at tackling the resize option afterwards, I know that can be done as well but too many pokers in the fire and I get sidetracked and frustrated, lol.

    Good news is I've got the read/write of IPTC down and how to set it, now I just need to make sense of the admin_refresh_metadata so I can reverse the process.
  • The key to understanding that is the recycle code. That is it limits the processing so that the scripts do not time out and
    "refreshes" the process passing a new starting point.

    A lot of the code in the garbage collect has nothing to do with the images and can be ignored. Another approac might be to use the code in the sitemap plugin. It marches throught the albums and their images. Of course, where it omits password protected ones, you will have to process them.
  • That might be a better option. Another option I was thinking of was actually just having it create a button on the image edit to save to IPTC. Still not sure of the best process yet.
  • I think that people will want the bulk action. But a button as well would be good.
  • Is it possible to have an admin utility that loads from the USER_PLUGIN_FOLDER or do they have to be under zp_core/utilities? I know I can have a standard plugin that does admin stuff, just a general question about placement of files etc.
  • Yes, of course. The plugin can register the `admin_utilities_buttons` filter to assign a utilities button. For examples look at some of the plugins in the dev-tools folder of the SVN.
  • Hmm... one of the things I noticed is that even though the class file allows writing to all the IPTC fields, it's having trouble writing the array for the keywords. And sadly arrays are not my strong suit. I'll keep banging my head until I get through the wall though :)
  • keywords are structured differently than everything else. look at the class image method `getIPTCTagArray()` to see how we deal with unpacking these. You would have to figure out how to reverse that algorithm.
Sign In or Register to comment.