mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Simplify
This commit is contained in:
parent
0415d1ccef
commit
5d19c26d59
@ -1403,31 +1403,21 @@ namespace Emby.Server.Implementations.Dto
|
|||||||
return item.GetDefaultPrimaryImageAspectRatio();
|
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
|
try
|
||||||
{
|
{
|
||||||
var size = _imageProcessor.GetImageDimensions(item, imageInfo);
|
var size = _imageProcessor.GetImageDimensions(item, imageInfo);
|
||||||
width = size.Width;
|
var width = size.Width;
|
||||||
height = size.Height;
|
var height = size.Height;
|
||||||
|
if (width > 0 && height > 0)
|
||||||
|
{
|
||||||
|
return (double)width / height;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Failed to determine primary image aspect ratio for {ImagePath}", imageInfo.Path);
|
_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();
|
return item.GetDefaultPrimaryImageAspectRatio();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user