exif: fix timezone parsing for Apple Quicktime
Signed-off-by: Varun Patil <radialapps@gmail.com>pull/653/head
parent
3acf02e7cf
commit
289317bbc6
10
lib/Exif.php
10
lib/Exif.php
|
@ -118,7 +118,15 @@ class Exif
|
||||||
public static function parseExifDate(array $exif): \DateTime
|
public static function parseExifDate(array $exif): \DateTime
|
||||||
{
|
{
|
||||||
// Get date from exif
|
// 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)) {
|
if (null === $exifDate || empty($exifDate) || !\is_string($exifDate)) {
|
||||||
throw new \Exception('No date found in exif');
|
throw new \Exception('No date found in exif');
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,6 +188,7 @@ export default defineComponent({
|
||||||
const date = (<any>this.$refs.editDate)?.result?.(p);
|
const date = (<any>this.$refs.editDate)?.result?.(p);
|
||||||
if (date) {
|
if (date) {
|
||||||
raw.DateTimeOriginal = date;
|
raw.DateTimeOriginal = date;
|
||||||
|
raw.CreateDate = date;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update EXIF if required
|
// Update EXIF if required
|
||||||
|
|
Loading…
Reference in New Issue