cvium 3 年之前
父节点
当前提交
5d19c26d59
共有 1 个文件被更改,包括 6 次插入16 次删除
  1. 6 16
      Emby.Server.Implementations/Dto/DtoService.cs

+ 6 - 16
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();
         }
     }