exif: fix timezone parsing for Apple Quicktime

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/653/head
Varun Patil 2023-04-30 04:22:22 -07:00
parent 3acf02e7cf
commit 289317bbc6
2 changed files with 10 additions and 1 deletions

View File

@ -118,7 +118,15 @@ class Exif
public static function parseExifDate(array $exif): \DateTime
{
// Get date from exif
$exifDate = $exif['SubSecDateTimeOriginal'] ?? $exif['DateTimeOriginal'] ?? $exif['CreateDate'] ?? null;
$exifDate = $exif['DateTimeOriginal'] ?? $exif['CreateDate'] ?? null;
// For MOV, the timezone of DateTimeOriginal is wrong because it's a string tag
// Note that we're passing "-api QuickTimeUTC=1" to exiftool
if ('video/quicktime' === $exif['MIMEType']) {
$exifDate = $exif['CreateDate'] ?? $exifDate;
}
// Check if we have a date
if (null === $exifDate || empty($exifDate) || !\is_string($exifDate)) {
throw new \Exception('No date found in exif');
}

View File

@ -188,6 +188,7 @@ export default defineComponent({
const date = (<any>this.$refs.editDate)?.result?.(p);
if (date) {
raw.DateTimeOriginal = date;
raw.CreateDate = date;
}
// Update EXIF if required