aboutsummaryrefslogtreecommitdiff
path: root/Emby.Drawing/ImageProcessor.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Emby.Drawing/ImageProcessor.cs')
-rw-r--r--Emby.Drawing/ImageProcessor.cs33
1 files changed, 12 insertions, 21 deletions
diff --git a/Emby.Drawing/ImageProcessor.cs b/Emby.Drawing/ImageProcessor.cs
index d4fce76d0..3faa3e3e9 100644
--- a/Emby.Drawing/ImageProcessor.cs
+++ b/Emby.Drawing/ImageProcessor.cs
@@ -1,5 +1,4 @@
-using Emby.Drawing.Common;
-using MediaBrowser.Common.Extensions;
+using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.IO;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Drawing;
@@ -399,6 +398,8 @@ namespace Emby.Drawing
{
size = GetImageSizeInternal(path, allowSlowMethod);
+ StartSaveImageSizeTimer();
+
_cachedImagedSizes.AddOrUpdate(cacheHash, size, (keyName, oldValue) => size);
}
@@ -413,28 +414,18 @@ namespace Emby.Drawing
/// <returns>ImageSize.</returns>
private ImageSize GetImageSizeInternal(string path, bool allowSlowMethod)
{
- ImageSize size;
-
- try
+ using (var file = TagLib.File.Create(path))
{
- size = ImageHeader.GetDimensions(path, _logger, _fileSystem);
- }
- catch
- {
- if (!allowSlowMethod)
- {
- throw;
- }
- //_logger.Info("Failed to read image header for {0}. Doing it the slow way.", path);
-
- CheckDisposed();
+ var image = file as TagLib.Image.File;
- size = _imageEncoder.GetImageSize(path);
+ var properties = image.Properties;
+
+ return new ImageSize
+ {
+ Height = properties.PhotoHeight,
+ Width = properties.PhotoWidth
+ };
}
-
- StartSaveImageSizeTimer();
-
- return size;
}
private readonly Timer _saveImageSizeTimer;