Exif module: getOriginationTimestamp with IPTC.DateCreated?

davidarnoult

Joined: 2008-03-18
Posts: 39
Posted: Tue, 2008-03-18 23:31

Hi Guys,

I have tried to get into source code of Exif module to modify the time stamp date to the field IPTC.DateCreated instead of Exif date.
Actually I have all my photos defined with IPTC date info tag, and I have seen that you were on this problem to add this feature.

In ExifHelper.class :

* @todo (xlerb) check for IPTC.DateCreated and IPTC.TimeCreated additionally? Problem: only
* date set by Adobe in IPTC, set time to 0 = midnight or 12 = noon? Also, which priority
* has it: it was explicitely set by the editor, thus first priority? Or to be considered
* just before IFD0.DateTime == last modification time?

My question is : how can I simply use this date IPTC.DateCreated instead of Exif when I add or update elements ?

I know that this is the function to modify:

function getOriginationTimestamp($path) {
$rawExifData = array();
ExifHelper::_fetchRawExifData($path, $rawExifData);
/*
* The method name indicates, that we want the earliest date available for the img.
* As of specs and practice with raw camera images and Adobe manipulated ones it seems,
* that SubIFD.DateTimeOriginal and SubIFD.DateTimeDigitized indicate creation time:
* both are set to shot time by cameras, scanners set only SubIFD.DateTimeDigitized.
* Adobe sets IFD0.DateTime to the last modification date/time. So we prefer creation date.
*/
foreach (array('SubIFD.DateTimeOriginal', 'SubIFD.DateTimeDigitized', 'IFD0.DateTime')
as $tag) {
$value = ExifHelper::getExifValue($rawExifData, explode('.', $tag));
if (isset($value)) {
$value = ExifHelper::_parseDate($value);
if (isset($value)) {
return $value;
}
}
}
return null;
}

Any hints?

Thank you for your help and congratulations for developping such a wonderful software!

Rgds

David

AttachmentSize
ExifHelper.zip8.8 KB