mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Merge pull request #6819 from cvium/why_should_we_use_the_imageinfo_when_we_can_guess
This commit is contained in:
commit
8c7dd0a691
@ -1404,44 +1404,27 @@ namespace Emby.Server.Implementations.Dto
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageDimensions size;
|
|
||||||
|
|
||||||
var defaultAspectRatio = item.GetDefaultPrimaryImageAspectRatio();
|
|
||||||
|
|
||||||
if (defaultAspectRatio > 0)
|
|
||||||
{
|
|
||||||
return defaultAspectRatio;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!imageInfo.IsLocalFile)
|
if (!imageInfo.IsLocalFile)
|
||||||
{
|
{
|
||||||
return null;
|
return item.GetDefaultPrimaryImageAspectRatio();
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
size = _imageProcessor.GetImageDimensions(item, imageInfo);
|
var size = _imageProcessor.GetImageDimensions(item, imageInfo);
|
||||||
|
var width = size.Width;
|
||||||
if (size.Width <= 0 || size.Height <= 0)
|
var height = size.Height;
|
||||||
|
if (width > 0 && height > 0)
|
||||||
{
|
{
|
||||||
return null;
|
return (double)width / height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Failed to determine primary image aspect ratio for {0}", imageInfo.Path);
|
_logger.LogError(ex, "Failed to determine primary image aspect ratio for {ImagePath}", imageInfo.Path);
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var width = size.Width;
|
return item.GetDefaultPrimaryImageAspectRatio();
|
||||||
var height = size.Height;
|
|
||||||
|
|
||||||
if (width <= 0 || height <= 0)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (double)width / height;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user