Skip to content

Commit 4276af5

Browse files
author
Marek Szymczuk
committed
Changed CreateDate to DateTimeOriginal in the ExifTool mapper (as in the Native mapper).
1 parent bacb61f commit 4276af5

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

lib/PHPExif/Mapper/Exiftool.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class Exiftool implements MapperInterface
3131
const CAPTIONABSTRACT = 'IPTC:Caption-Abstract';
3232
const COLORSPACE = 'ExifIFD:ColorSpace';
3333
const COPYRIGHT = 'IFD0:Copyright';
34-
const CREATEDATE = 'ExifIFD:CreateDate';
34+
const DATETIMEORIGINAL = 'ExifIFD:DateTimeOriginal';
3535
const CREDIT = 'IPTC:Credit';
3636
const EXPOSURETIME = 'ExifIFD:ExposureTime';
3737
const FILESIZE = 'System:FileSize';
@@ -66,7 +66,7 @@ class Exiftool implements MapperInterface
6666
self::CAPTION => Exif::CAPTION,
6767
self::COLORSPACE => Exif::COLORSPACE,
6868
self::COPYRIGHT => Exif::COPYRIGHT,
69-
self::CREATEDATE => Exif::CREATION_DATE,
69+
self::DATETIMEORIGINAL => Exif::CREATION_DATE,
7070
self::CREDIT => Exif::CREDIT,
7171
self::EXPOSURETIME => Exif::EXPOSURE,
7272
self::FILESIZE => Exif::FILESIZE,
@@ -135,7 +135,7 @@ public function mapRawData(array $data)
135135
case self::APPROXIMATEFOCUSDISTANCE:
136136
$value = sprintf('%1$sm', $value);
137137
break;
138-
case self::CREATEDATE:
138+
case self::DATETIMEORIGINAL:
139139
try {
140140
$value = new DateTime($value);
141141
} catch (\Exception $exception) {

tests/PHPExif/Mapper/ExiftoolMapperTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function testMapRawDataMapsFieldsCorrectly()
4444
// ignore custom formatted data stuff:
4545
unset($map[\PHPExif\Mapper\Exiftool::APERTURE]);
4646
unset($map[\PHPExif\Mapper\Exiftool::APPROXIMATEFOCUSDISTANCE]);
47-
unset($map[\PHPExif\Mapper\Exiftool::CREATEDATE]);
47+
unset($map[\PHPExif\Mapper\Exiftool::DATETIMEORIGINAL]);
4848
unset($map[\PHPExif\Mapper\Exiftool::EXPOSURETIME]);
4949
unset($map[\PHPExif\Mapper\Exiftool::FOCALLENGTH]);
5050
unset($map[\PHPExif\Mapper\Exiftool::GPSLATITUDE]);
@@ -103,7 +103,7 @@ public function testMapRawDataCorrectlyFormatsFocusDistance()
103103
public function testMapRawDataCorrectlyFormatsCreationDate()
104104
{
105105
$rawData = array(
106-
\PHPExif\Mapper\Exiftool::CREATEDATE => '2015:04:01 12:11:09',
106+
\PHPExif\Mapper\Exiftool::DATETIMEORIGINAL => '2015:04:01 12:11:09',
107107
);
108108

109109
$mapped = $this->mapper->mapRawData($rawData);
@@ -123,7 +123,7 @@ public function testMapRawDataCorrectlyFormatsCreationDate()
123123
public function testMapRawDataCorrectlyIgnoresIncorrectCreationDate()
124124
{
125125
$rawData = array(
126-
\PHPExif\Mapper\Exiftool::CREATEDATE => '2015:04:01',
126+
\PHPExif\Mapper\Exiftool::DATETIMEORIGINAL => '2015:04:01',
127127
);
128128

129129
$mapped = $this->mapper->mapRawData($rawData);
@@ -262,7 +262,7 @@ public function testSetNumericInProperty()
262262
public function testMapRawDataCorrectlyFormatsDifferentDateTimeString()
263263
{
264264
$rawData = array(
265-
\PHPExif\Mapper\Exiftool::CREATEDATE => '2014-12-15 00:12:00'
265+
\PHPExif\Mapper\Exiftool::DATETIMEORIGINAL => '2014-12-15 00:12:00'
266266
);
267267

268268
$mapped = $this->mapper->mapRawData(
@@ -280,7 +280,7 @@ public function testMapRawDataCorrectlyFormatsDifferentDateTimeString()
280280
public function testMapRawDataCorrectlyIgnoresInvalidCreateDate()
281281
{
282282
$rawData = array(
283-
\PHPExif\Mapper\Exiftool::CREATEDATE => 'Invalid Date String'
283+
\PHPExif\Mapper\Exiftool::DATETIMEORIGINAL => 'Invalid Date String'
284284
);
285285

286286
$result = $this->mapper->mapRawData(

0 commit comments

Comments
 (0)