diff options
| author | cvium <clausvium@gmail.com> | 2021-11-10 23:46:56 +0100 |
|---|---|---|
| committer | cvium <clausvium@gmail.com> | 2021-11-10 23:46:56 +0100 |
| commit | 5d19c26d5966db3ff48c73f409290509815cd89a (patch) | |
| tree | 5c7597f3c9853d977216f3bd4a761992614f7bfe | |
| parent | 0415d1ccef19c48a2eaa3c545648ce657f95cfb8 (diff) | |
Simplify
| -rw-r--r-- | Emby.Server.Implementations/Dto/DtoService.cs | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/Emby.Server.Implementations/Dto/DtoService.cs b/Emby.Server.Implementations/Dto/DtoService.cs index f23f4a13f..ab5d45279 100644 --- a/Emby.Server.Implementations/Dto/DtoService.cs +++ b/Emby.Server.Implementations/Dto/DtoService.cs @@ -1403,31 +1403,21 @@ namespace Emby.Server.Implementations.Dto return item.GetDefaultPrimaryImageAspectRatio(); } - var width = imageInfo.Width; - var height = imageInfo.Height; - - if (width > 0 && height > 0) - { - return (double)width / height; - } - - // Fallback to the image processor if the image info is somehow incorrect try { var size = _imageProcessor.GetImageDimensions(item, imageInfo); - width = size.Width; - height = size.Height; + var width = size.Width; + var height = size.Height; + if (width > 0 && height > 0) + { + return (double)width / height; + } } catch (Exception ex) { _logger.LogError(ex, "Failed to determine primary image aspect ratio for {ImagePath}", imageInfo.Path); } - if (width > 0 && height > 0) - { - return (double)width / height; - } - return item.GetDefaultPrimaryImageAspectRatio(); } } |
