aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Drawing/ImageManager.cs
diff options
context:
space:
mode:
authorLukePulverenti <luke.pulverenti@gmail.com>2013-02-21 16:39:53 -0500
committerLukePulverenti <luke.pulverenti@gmail.com>2013-02-21 16:40:04 -0500
commit931c0ea455161b8ee00005a0ffd1f8afab41f7bb (patch)
treeb65f76bad393dc8b5a24f26722332de807ed202a /MediaBrowser.Controller/Drawing/ImageManager.cs
parent8f41685a967794caccae8fae65c1a0e975ccfda4 (diff)
more dependancy injection
Diffstat (limited to 'MediaBrowser.Controller/Drawing/ImageManager.cs')
-rw-r--r--MediaBrowser.Controller/Drawing/ImageManager.cs17
1 files changed, 13 insertions, 4 deletions
diff --git a/MediaBrowser.Controller/Drawing/ImageManager.cs b/MediaBrowser.Controller/Drawing/ImageManager.cs
index c033fd1f4..2077525a3 100644
--- a/MediaBrowser.Controller/Drawing/ImageManager.cs
+++ b/MediaBrowser.Controller/Drawing/ImageManager.cs
@@ -15,6 +15,7 @@ using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
+using MediaBrowser.Model.Logging;
namespace MediaBrowser.Controller.Drawing
{
@@ -52,12 +53,20 @@ namespace MediaBrowser.Controller.Drawing
private readonly ConcurrentDictionary<string, Task<ImageSize>> _cachedImagedSizes = new ConcurrentDictionary<string, Task<ImageSize>>();
/// <summary>
+ /// The _logger
+ /// </summary>
+ private readonly ILogger _logger;
+
+ /// <summary>
/// Initializes a new instance of the <see cref="ImageManager" /> class.
/// </summary>
/// <param name="kernel">The kernel.</param>
- public ImageManager(Kernel kernel)
+ /// <param name="logger">The logger.</param>
+ public ImageManager(Kernel kernel, ILogger logger)
: base(kernel)
{
+ _logger = logger;
+
ImageSizeCache = new FileSystemRepository(Path.Combine(Kernel.ApplicationPaths.ImageCachePath, "image-sizes"));
ResizedImageCache = new FileSystemRepository(Path.Combine(Kernel.ApplicationPaths.ImageCachePath, "resized-images"));
CroppedImageCache = new FileSystemRepository(Path.Combine(Kernel.ApplicationPaths.ImageCachePath, "cropped-images"));
@@ -103,7 +112,7 @@ namespace MediaBrowser.Controller.Drawing
catch (Exception ex)
{
// We have to have a catch-all here because some of the .net image methods throw a plain old Exception
- Logger.ErrorException("Error cropping image", ex);
+ _logger.ErrorException("Error cropping image", ex);
}
}
@@ -121,7 +130,7 @@ namespace MediaBrowser.Controller.Drawing
}
catch
{
- Logger.Error("Error enhancing image");
+ _logger.Error("Error enhancing image");
}
var originalImageSize = await GetImageSize(originalImagePath, dateModified).ConfigureAwait(false);
@@ -276,7 +285,7 @@ namespace MediaBrowser.Controller.Drawing
// Cache file doesn't exist no biggie
}
- var size = ImageHeader.GetDimensions(imagePath, Logger);
+ var size = ImageHeader.GetDimensions(imagePath, _logger);
var imageSize = new ImageSize { Width = size.Width, Height = size.Height };