Skip to content

Commit

Permalink
Handle dimensions of rotated videos
Browse files Browse the repository at this point in the history
  • Loading branch information
grischaerbe committed Feb 21, 2025
1 parent 4ace966 commit 2e1218c
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/Assets/Attributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,19 @@ private function getVideoAttributes()
{
$id3 = ExtractInfo::fromAsset($this->asset);

$width = Arr::get($id3, 'video.resolution_x');
$height = Arr::get($id3, 'video.resolution_y');
$rotate = Arr::get($id3, 'video.rotate', 0);

// Adjust width and height if the video is rotated
if (in_array($rotate, [90, 270, -90, -270])) {
list($width, $height) = [$height, $width];
}

return [
'width' => Arr::get($id3, 'video.resolution_x'),
'height' => Arr::get($id3, 'video.resolution_y'),
'duration' => Arr::get($id3, 'playtime_seconds'),
'width' => $width,
'height' => $height,
'duration' => Arr::get($id3, 'playtime_seconds')
];
}
}

0 comments on commit 2e1218c

Please sign in to comment.