Skip to content

Suggestion on supporting IPTC2 tags #49

Open
@FrivalszkyP

Description

@FrivalszkyP

Thanks for yesterday's quick review of my pull request!

I have a suggestion for supporting some of the IPTC2 tags. As of right now, I'm doing this by extending your \PHPExif\Mapper\Exiftool class and adding just a couple of lines of code. But this could be done more neatly I believe. Here's the code I'm using (I've omitted my namespace declaration for code copyright reasons):

use \PHPExif\Exif;
use \DateTime;

/**
 * PHP Exif Exiftool Mapper
 *
 * Maps Exiftool raw data to valid data for the \PHPExif\Exif class
 *
 * @category    PHPExif
 * @package     Mapper
 */
class Mapper extends \PHPExif\Mapper\Exiftool
{
    const CREDIT2                  = 'IPTC2:Credit';
    const BYLINE                   = 'IPTC:By-line';
    function __construct() {
        $this->map[ self::CREDIT2 ] = Exif::CREDIT;
        $this->map[ self::BYLINE ]  = Exif::AUTHOR;
    }
}

I do not want to push this and submit it as a pull request as my version simply overwrites the original Exif::CREDIT and Exif::AUTHOR values. It suits my needs, but it might not be the best idea for general purposes.

I'm attaching an image that is suitable for testing. (It's the same image I submitted for yesterday's pull request, but I have more examples if needed).

europress-getty1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions