exif: ignore all invalid dates
Signed-off-by: Varun Patil <varunpatil@ucla.edu>pull/563/head
parent
7faa4afb1e
commit
0c17d7e209
17
lib/Exif.php
17
lib/Exif.php
|
@ -117,9 +117,20 @@ class Exif
|
||||||
// We need to remove blacklisted fields to prevent leaking info
|
// We need to remove blacklisted fields to prevent leaking info
|
||||||
unset($exif['SourceFile'], $exif['FileName'], $exif['ExifToolVersion'], $exif['Directory'], $exif['FileSize'], $exif['FileModifyDate'], $exif['FileAccessDate'], $exif['FileInodeChangeDate'], $exif['FilePermissions'], $exif['ThumbnailImage']);
|
unset($exif['SourceFile'], $exif['FileName'], $exif['ExifToolVersion'], $exif['Directory'], $exif['FileSize'], $exif['FileModifyDate'], $exif['FileAccessDate'], $exif['FileInodeChangeDate'], $exif['FilePermissions'], $exif['ThumbnailImage']);
|
||||||
|
|
||||||
// Ignore zero date
|
// Ignore zero dates
|
||||||
if (\array_key_exists('DateTimeOriginal', $exif) && '0000:00:00 00:00:00' === $exif['DateTimeOriginal']) {
|
$dateFields = [
|
||||||
unset($exif['DateTimeOriginal']);
|
'DateTimeOriginal',
|
||||||
|
'CreateDate',
|
||||||
|
'ModifyDate',
|
||||||
|
'TrackCreateDate',
|
||||||
|
'TrackModifyDate',
|
||||||
|
'MediaCreateDate',
|
||||||
|
'MediaModifyDate',
|
||||||
|
];
|
||||||
|
foreach ($dateFields as $field) {
|
||||||
|
if (\array_key_exists($field, $exif) && \is_string($exif[$field]) && str_starts_with($exif[$field], '0000:00:00')) {
|
||||||
|
unset($exif[$field]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ignore zero lat lng
|
// Ignore zero lat lng
|
||||||
|
|
Loading…
Reference in New Issue