Skip to content

Commit 837dc60

Browse files
committed
Merge pull request #45 from bonzai/master
Fixed duplicated tags
2 parents 09eead9 + 4276af5 commit 837dc60

File tree

3 files changed

+41
-41
lines changed

3 files changed

+41
-41
lines changed

lib/PHPExif/Adapter/Exiftool.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function getExifFromFile($file)
102102
{
103103
$result = $this->getCliOutput(
104104
sprintf(
105-
'%1$s%3$s -j -a -G0 -c %4$s %2$s',
105+
'%1$s%3$s -j -a -G1 -c %4$s %2$s',
106106
$this->getToolPath(),
107107
escapeshellarg($file),
108108
$this->numeric ? ' -n' : '',

lib/PHPExif/Mapper/Exiftool.php

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,33 +25,33 @@
2525
class Exiftool implements MapperInterface
2626
{
2727
const APERTURE = 'Composite:Aperture';
28-
const APPROXIMATEFOCUSDISTANCE = 'XMP:ApproximateFocusDistance';
29-
const ARTIST = 'EXIF:Artist';
30-
const CAPTION = 'XMP:Caption';
28+
const APPROXIMATEFOCUSDISTANCE = 'XMP-aux:ApproximateFocusDistance';
29+
const ARTIST = 'IFD0:Artist';
30+
const CAPTION = 'XMP-acdsee';
3131
const CAPTIONABSTRACT = 'IPTC:Caption-Abstract';
32-
const COLORSPACE = 'EXIF:ColorSpace';
33-
const COPYRIGHT = 'EXIF:Copyright';
34-
const CREATEDATE = 'EXIF:CreateDate';
32+
const COLORSPACE = 'ExifIFD:ColorSpace';
33+
const COPYRIGHT = 'IFD0:Copyright';
34+
const DATETIMEORIGINAL = 'ExifIFD:DateTimeOriginal';
3535
const CREDIT = 'IPTC:Credit';
36-
const EXPOSURETIME = 'EXIF:ExposureTime';
37-
const FILESIZE = 'File:FileSize';
38-
const FOCALLENGTH = 'EXIF:FocalLength';
36+
const EXPOSURETIME = 'ExifIFD:ExposureTime';
37+
const FILESIZE = 'System:FileSize';
38+
const FOCALLENGTH = 'ExifIFD:FocalLength';
3939
const HEADLINE = 'IPTC:Headline';
4040
const IMAGEHEIGHT = 'File:ImageHeight';
4141
const IMAGEWIDTH = 'File:ImageWidth';
42-
const ISO = 'EXIF:ISO';
42+
const ISO = 'ExifIFD:ISO';
4343
const JOBTITLE = 'IPTC:By-lineTitle';
4444
const KEYWORDS = 'IPTC:Keywords';
4545
const MIMETYPE = 'File:MIMEType';
46-
const MODEL = 'EXIF:Model';
47-
const ORIENTATION = 'EXIF:Orientation';
48-
const SOFTWARE = 'EXIF:Software';
46+
const MODEL = 'IFD0:Model';
47+
const ORIENTATION = 'IFD0:Orientation';
48+
const SOFTWARE = 'IFD0:Software';
4949
const SOURCE = 'IPTC:Source';
5050
const TITLE = 'IPTC:ObjectName';
51-
const XRESOLUTION = 'EXIF:XResolution';
52-
const YRESOLUTION = 'EXIF:YResolution';
53-
const GPSLATITUDE = 'EXIF:GPSLatitude';
54-
const GPSLONGITUDE = 'EXIF:GPSLongitude';
51+
const XRESOLUTION = 'IFD0:XResolution';
52+
const YRESOLUTION = 'IFD0:YResolution';
53+
const GPSLATITUDE = 'GPS:GPSLatitude';
54+
const GPSLONGITUDE = 'GPS:GPSLongitude';
5555

5656
/**
5757
* Maps the ExifTool fields to the fields of
@@ -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) {
@@ -172,8 +172,8 @@ public function mapRawData(array $data)
172172

173173
// add GPS coordinates, if available
174174
if (count($gpsData) === 2 && $gpsData['lat'] !== false && $gpsData['lon'] !== false) {
175-
$latitudeRef = empty($data['EXIF:GPSLatitudeRef'][0]) ? 'N' : $data['EXIF:GPSLatitudeRef'][0];
176-
$longitudeRef = empty($data['EXIF:GPSLongitudeRef'][0]) ? 'E' : $data['EXIF:GPSLongitudeRef'][0];
175+
$latitudeRef = empty($data['GPS:GPSLatitudeRef'][0]) ? 'N' : $data['GPS:GPSLatitudeRef'][0];
176+
$longitudeRef = empty($data['GPS:GPSLongitudeRef'][0]) ? 'E' : $data['GPS:GPSLongitudeRef'][0];
177177

178178
$gpsLocation = sprintf(
179179
'%s,%s',

tests/PHPExif/Mapper/ExiftoolMapperTest.php

Lines changed: 19 additions & 19 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);
@@ -177,10 +177,10 @@ public function testMapRawDataCorrectlyFormatsGPSData()
177177
$this->mapper->setNumeric(false);
178178
$result = $this->mapper->mapRawData(
179179
array(
180-
'EXIF:GPSLatitude' => '40 deg 20\' 0.42857" N',
181-
'EXIF:GPSLatitudeRef' => 'North',
182-
'EXIF:GPSLongitude' => '20 deg 10\' 2.33333" W',
183-
'EXIF:GPSLongitudeRef' => 'West',
180+
\PHPExif\Mapper\Exiftool::GPSLATITUDE => '40 deg 20\' 0.42857" N',
181+
'GPS:GPSLatitudeRef' => 'North',
182+
\PHPExif\Mapper\Exiftool::GPSLONGITUDE => '20 deg 10\' 2.33333" W',
183+
'GPS:GPSLongitudeRef' => 'West',
184184
)
185185
);
186186

@@ -197,10 +197,10 @@ public function testMapRawDataCorrectlyFormatsNumericGPSData()
197197
{
198198
$result = $this->mapper->mapRawData(
199199
array(
200-
'EXIF:GPSLatitude' => '40.333452381',
201-
'EXIF:GPSLatitudeRef' => 'North',
202-
'EXIF:GPSLongitude' => '20.167314814',
203-
'EXIF:GPSLongitudeRef' => 'West',
200+
\PHPExif\Mapper\Exiftool::GPSLATITUDE => '40.333452381',
201+
'GPS:GPSLatitudeRef' => 'North',
202+
\PHPExif\Mapper\Exiftool::GPSLONGITUDE => '20.167314814',
203+
'GPS:GPSLongitudeRef' => 'West',
204204
)
205205
);
206206

@@ -218,10 +218,10 @@ public function testMapRawDataCorrectlyIgnoresIncorrectGPSData()
218218
$this->mapper->setNumeric(false);
219219
$result = $this->mapper->mapRawData(
220220
array(
221-
'EXIF:GPSLatitude' => '40.333452381',
222-
'EXIF:GPSLatitudeRef' => 'North',
223-
'EXIF:GPSLongitude' => '20.167314814',
224-
'EXIF:GPSLongitudeRef' => 'West',
221+
\PHPExif\Mapper\Exiftool::GPSLATITUDE => '40.333452381',
222+
'GPS:GPSLatitudeRef' => 'North',
223+
\PHPExif\Mapper\Exiftool::GPSLONGITUDE => '20.167314814',
224+
'GPS:GPSLongitudeRef' => 'West',
225225
)
226226
);
227227

@@ -236,8 +236,8 @@ public function testMapRawDataCorrectlyIgnoresIncompleteGPSData()
236236
{
237237
$result = $this->mapper->mapRawData(
238238
array(
239-
'EXIF:GPSLatitude' => '40.333452381',
240-
'EXIF:GPSLatitudeRef' => 'North',
239+
\PHPExif\Mapper\Exiftool::GPSLATITUDE => '40.333452381',
240+
'GPS:GPSLatitudeRef' => 'North',
241241
)
242242
);
243243

@@ -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)