diff options
Diffstat (limited to 'Emby.Drawing/ImageProcessor.cs')
| -rw-r--r-- | Emby.Drawing/ImageProcessor.cs | 41 |
1 files changed, 12 insertions, 29 deletions
diff --git a/Emby.Drawing/ImageProcessor.cs b/Emby.Drawing/ImageProcessor.cs index 4095e4176..f91990442 100644 --- a/Emby.Drawing/ImageProcessor.cs +++ b/Emby.Drawing/ImageProcessor.cs @@ -422,10 +422,10 @@ namespace Emby.Drawing public ImageSize GetImageSize(BaseItem item, ItemImageInfo info) { - return GetImageSize(item, info, false, true); + return GetImageSize(item, info, true); } - public ImageSize GetImageSize(BaseItem item, ItemImageInfo info, bool allowSlowMethods, bool updateItem) + public ImageSize GetImageSize(BaseItem item, ItemImageInfo info, bool updateItem) { var width = info.Width; var height = info.Height; @@ -442,7 +442,7 @@ namespace Emby.Drawing var path = info.Path; _logger.LogInformation("Getting image size for item {0} {1}", item.GetType().Name, path); - var size = GetImageSize(path, allowSlowMethods); + var size = GetImageSize(path); info.Height = Convert.ToInt32(size.Height); info.Width = Convert.ToInt32(size.Width); @@ -455,43 +455,26 @@ namespace Emby.Drawing return size; } - public ImageSize GetImageSize(string path) - { - return GetImageSize(path, true); - } - /// <summary> /// Gets the size of the image. /// </summary> - private ImageSize GetImageSize(string path, bool allowSlowMethod) + public ImageSize GetImageSize(string path) { if (string.IsNullOrEmpty(path)) { throw new ArgumentNullException(nameof(path)); } - try - { - using (var s = new SKFileStream(path)) - using (var codec = SKCodec.Create(s)) - { - var info = codec.Info; - return new ImageSize - { - Height = info.Height, - Width = info.Width - }; - } - } - catch - { - if (!allowSlowMethod) + using (var s = new SKFileStream(path)) + using (var codec = SKCodec.Create(s)) { - throw; + var info = codec.Info; + return new ImageSize + { + Height = info.Height, + Width = info.Width + }; } - } - - return _imageEncoder.GetImageSize(path); } /// <summary> |
