Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions lib/PHPExif/Mapper/ImageMagick.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class ImageMagick extends AbstractMapper
public const ARTIST = 'exif:Artist';
public const COLORSPACE = 'exif:ColorSpace';
public const COPYRIGHT = 'exif:Copyright';
public const CREATION_DATE = 'date:create';
public const DATETIMEORIGINAL = 'exif:DateTimeOriginal';
public const DESCRIPTION = 'exif:ImageDescription';
public const EXPOSURETIME = 'exif:ExposureTime';
Expand Down Expand Up @@ -74,7 +73,6 @@ class ImageMagick extends AbstractMapper
self::ARTIST => Exif::AUTHOR,
self::COLORSPACE => Exif::COLORSPACE,
self::COPYRIGHT => Exif::COPYRIGHT,
self::CREATION_DATE => Exif::CREATION_DATE,
self::DATETIMEORIGINAL => Exif::CREATION_DATE,
self::DESCRIPTION => Exif::DESCRIPTION,
self::EXPOSURETIME => Exif::EXPOSURE,
Expand Down Expand Up @@ -145,18 +143,6 @@ public function mapRawData(array $data): array
}
$value = sprintf('f/%01.1f', $value);
break;
case self::CREATION_DATE:
if (!isset($mappedData[Exif::CREATION_DATE])
&& preg_match('/^0000[-:]00[-:]00.00:00:00/', $value) === 0) {
try {
$value = new DateTime($value);
} catch (\Exception $e) {
continue 2;
}
} else {
continue 2;
}
break;
case self::DATETIMEORIGINAL:
if (preg_match('/^0000[-:]00[-:]00.00:00:00/', $value) === 1) {
continue 2;
Expand Down
77 changes: 0 additions & 77 deletions tests/PHPExif/Mapper/ImageMagickMapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ public function testMapRawDataMapsFieldsCorrectly()
unset($map[ImageMagick::HEIGHT]);
unset($map[ImageMagick::IMAGEHEIGHT_PNG]);
unset($map[ImageMagick::IMAGEWIDTH_PNG]);
unset($map[ImageMagick::CREATION_DATE]);
unset($map[ImageMagick::COPYRIGHT_IPTC]);

// create raw data
Expand Down Expand Up @@ -85,25 +84,6 @@ public function testMapRawDataCorrectlyFormatsAperture()
$this->assertEquals('f/1.7', reset($mapped));
}

/**
* @group mapper
*/
public function testMapRawDataCorrectlyFormatsCreationDate()
{
$rawData = array(
ImageMagick::CREATION_DATE => '2015:04:01 12:11:09',
);

$mapped = $this->mapper->mapRawData($rawData);

$result = reset($mapped);
$this->assertInstanceOf('\\DateTime', $result);
$this->assertEquals(
reset($rawData),
$result->format('Y:m:d H:i:s')
);
}

/**
* @group mapper
*/
Expand All @@ -123,48 +103,6 @@ public function testMapRawDataCorrectlyFormatsDateTimeOriginal()
);
}

/**
* @group mapper
*/
public function testMapRawDataCorrectlyFormatsCreationDateAndDateTimeOriginal1()
{
$rawData = array(
ImageMagick::CREATION_DATE => '2016:04:01 12:11:09',
ImageMagick::DATETIMEORIGINAL => '2015:04:01 12:11:09',
);

$mapped = $this->mapper->mapRawData($rawData);

$result = reset($mapped);
$expected = new \DateTime('2015:04:01 12:11:09');
$this->assertInstanceOf('\\DateTime', $result);
$this->assertEquals(
$expected,
$result
);
}

/**
* @group mapper
*/
public function testMapRawDataCorrectlyFormatsCreationDateAndDateTimeOriginal2()
{
$rawData = array(
ImageMagick::DATETIMEORIGINAL => '2015:04:01 12:11:09',
ImageMagick::CREATION_DATE => '2016:04:01 12:11:09',
);

$mapped = $this->mapper->mapRawData($rawData);

$result = reset($mapped);
$expected = new \DateTime('2015:04:01 12:11:09');
$this->assertInstanceOf('\\DateTime', $result);
$this->assertEquals(
$expected,
$result
);
}

/**
* @group mapper
*/
Expand Down Expand Up @@ -233,21 +171,6 @@ public function testMapRawDataCorrectlyFormatsCreationDateWithTimeZone2()
);
}

/**
* @group mapper
*/
public function testMapRawDataCorrectlyIgnoresIncorrectCreationDate()
{
$rawData = array(
ImageMagick::CREATION_DATE => '2015:04:01',
);

$mapped = $this->mapper->mapRawData($rawData);

$this->assertEquals(false, reset($mapped));
}


/**
* @group mapper
*/
Expand Down