V1.4.6: Where does it read and save IPTC information?

I am trying to find where in the code it reads and saves the IPTC information from an image during the upload process. I want to automatically convert line breaks in the description field to either `
` or format with `

` tags before it saves that information into the database so that I don't have to edit 100s of image descriptions before or after I upload them.

Thanks,
Mark H

Comments

  • MarkRH Member
    I found it. It's in \zp-core\class-image.php. Now I can do what I want. Actually, just needed to 1 line of code to convert newlines to HTML breaks:

    `
    /* iptc description */
    $desc = $this->get('IPTCImageCaption');
    if (!empty($desc)) {
    // mrh add code to add line breaks.
    $desc = nl2br($desc);
    $this->setDesc($desc);
    }
    `
  • acrylian Administrator, Developer
    It is not recommended to hack the core as you have to re-apply your change to every update. Better would be to open a feature suggestion ticket maybe.

    The meta data is saved on each row on the "images" table btw.
  • MarkRH Member
    Oh I know it's not recommended and why I always comment what I've done so I can do a global search on the files to see what I've modified when an update is available. (I back everything up prior to any kind of core updates.) I prefer not doing it but sometimes I have to. I've been doing it with the Gallery 3 and WordPress code and their plug-ins for some time.

    Anyway, I did at least make a duplicate of the Garland theme that I am working on. I had do to a global search and replace for "garland" to "mygarland"; otherwise, it was still using some files from the original theme's folder.

    But, I'll go ahead and make that suggestion as it's straight forward and what most user's would expect to happen when IPTC descriptions are imported. Of course, then you have to worry about them having already added the `
    ` tags into the IPTC description.. :/
  • acrylian Administrator, Developer
    Sure, I just wanted to mention it. The line break conversion we probably wil add as an option anyway.
Sign In or Register to comment.