Skip to content

Commit

Permalink
lp: add support for more Samsung JPEG (fix #1265)
Browse files Browse the repository at this point in the history
Signed-off-by: Varun Patil <radialapps@gmail.com>
  • Loading branch information
pulsejet committed Sep 20, 2024
1 parent c55ca6a commit 85e185d
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions lib/Db/LivePhoto.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,22 @@ public function getLivePhotoId(File $file, array $exif): string
return "self__traileroffset={$videoOffset}";
}

// Samsung JPEG (tested w/ S24)
// https://github.com/pulsejet/memories/issues/1265
if (($embedType = $exif['EmbeddedVideoType'] ?? null)
&& \in_array($embedType, ['MotionPhoto_Data'], true)
&& ($exif['EmbeddedVideoFile'] ?? null)
) {
// Binary exif field, decode when the user requests it
// While this is the most reliable way, it is slow
return 'self__exifbin=EmbeddedVideoFile';
}

// Samsung HEIC (tested w/ S21)
if (!empty($exif['MotionPhotoVideo'] ?? null)) {
return 'self__exifbin=MotionPhotoVideo';
}

// Google JPEG and Samsung HEIC / JPEG (Apple?)
if ($exif['MotionPhoto'] ?? null) {
if ('image/jpeg' === ($exif['MIMEType'] ?? null)) {
Expand Down Expand Up @@ -109,12 +125,6 @@ public function getLivePhotoId(File $file, array $exif): string
}
}

// Samsung HEIC (at least S21)
if (!empty($exif['MotionPhotoVideo'] ?? null)) {
// It's a binary exif field, decode when the user requests it
return 'self__exifbin=MotionPhotoVideo';
}

return '';
}

Expand Down

0 comments on commit 85e185d

Please sign in to comment.