exif: ignore all invalid dates

Signed-off-by: Varun Patil <varunpatil@ucla.edu>
pull/563/head
Varun Patil 2023-03-27 12:46:12 -07:00
parent 7faa4afb1e
commit 0c17d7e209
1 changed files with 14 additions and 3 deletions

View File

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