aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MediaBrowser.Server.Implementations/Drawing/ImageHeader.cs28
-rw-r--r--MediaBrowser.Server.Implementations/Drawing/ImageProcessor.cs32
-rw-r--r--MediaBrowser.ServerApplication/MainStartup.cs2
-rw-r--r--MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj109
4 files changed, 88 insertions, 83 deletions
diff --git a/MediaBrowser.Server.Implementations/Drawing/ImageHeader.cs b/MediaBrowser.Server.Implementations/Drawing/ImageHeader.cs
index 6287d0bb8..7117482c8 100644
--- a/MediaBrowser.Server.Implementations/Drawing/ImageHeader.cs
+++ b/MediaBrowser.Server.Implementations/Drawing/ImageHeader.cs
@@ -1,5 +1,4 @@
-using ImageMagickSharp;
-using MediaBrowser.Common.IO;
+using MediaBrowser.Common.IO;
using MediaBrowser.Model.Drawing;
using MediaBrowser.Model.Logging;
using System;
@@ -47,32 +46,13 @@ namespace MediaBrowser.Server.Implementations.Drawing
/// <exception cref="ArgumentException">The image was of an unrecognised format.</exception>
public static ImageSize GetDimensions(string path, ILogger logger, IFileSystem fileSystem)
{
- try
+ using (var fs = File.OpenRead(path))
{
- using (var fs = File.OpenRead(path))
+ using (var binaryReader = new BinaryReader(fs))
{
- using (var binaryReader = new BinaryReader(fs))
- {
- return GetDimensions(binaryReader);
- }
+ return GetDimensions(binaryReader);
}
}
- catch
- {
- logger.Info("Failed to read image header for {0}. Doing it the slow way.", path);
- }
-
- using (var wand = new MagickWand())
- {
- wand.PingImage(path);
- var img = wand.CurrentImage;
-
- return new ImageSize
- {
- Width = img.Width,
- Height = img.Height
- };
- }
}
/// <summary>
diff --git a/MediaBrowser.Server.Implementations/Drawing/ImageProcessor.cs b/MediaBrowser.Server.Implementations/Drawing/ImageProcessor.cs
index 64c812e1b..80cfd7f3e 100644
--- a/MediaBrowser.Server.Implementations/Drawing/ImageProcessor.cs
+++ b/MediaBrowser.Server.Implementations/Drawing/ImageProcessor.cs
@@ -203,7 +203,7 @@ namespace MediaBrowser.Server.Implementations.Drawing
try
{
CheckDisposed();
-
+
var newWidth = Convert.ToInt32(newSize.Width);
var newHeight = Convert.ToInt32(newSize.Height);
@@ -329,7 +329,7 @@ namespace MediaBrowser.Server.Implementations.Drawing
try
{
Directory.CreateDirectory(Path.GetDirectoryName(croppedImagePath));
-
+
using (var wand = new MagickWand(originalImagePath))
{
wand.CurrentImage.TrimImage(10);
@@ -450,12 +450,34 @@ namespace MediaBrowser.Server.Implementations.Drawing
/// <returns>ImageSize.</returns>
private ImageSize GetImageSizeInternal(string path)
{
- CheckDisposed();
- var size = ImageHeader.GetDimensions(path, _logger, _fileSystem);
+ ImageSize size;
+
+ try
+ {
+ size = ImageHeader.GetDimensions(path, _logger, _fileSystem);
+ }
+ catch
+ {
+ _logger.Info("Failed to read image header for {0}. Doing it the slow way.", path);
+
+ CheckDisposed();
+
+ using (var wand = new MagickWand())
+ {
+ wand.PingImage(path);
+ var img = wand.CurrentImage;
+
+ size = new ImageSize
+ {
+ Width = img.Width,
+ Height = img.Height
+ };
+ }
+ }
StartSaveImageSizeTimer();
- return new ImageSize { Width = size.Width, Height = size.Height };
+ return size;
}
private readonly Timer _saveImageSizeTimer;
diff --git a/MediaBrowser.ServerApplication/MainStartup.cs b/MediaBrowser.ServerApplication/MainStartup.cs
index 4bf51bc6b..598ec1fd7 100644
--- a/MediaBrowser.ServerApplication/MainStartup.cs
+++ b/MediaBrowser.ServerApplication/MainStartup.cs
@@ -41,7 +41,7 @@ namespace MediaBrowser.ServerApplication
var applicationPath = currentProcess.MainModule.FileName;
- Wand.SetMagickCoderModulePath(Path.Combine(Path.GetDirectoryName(applicationPath), "ImageMagickCoders", "x86"));
+ //Wand.SetMagickCoderModulePath(Path.Combine(Path.GetDirectoryName(applicationPath), "ImageMagickCoders", "x86"));
var appPaths = CreateApplicationPaths(applicationPath, _isRunningAsService);
var logManager = new NlogManager(appPaths.LogDirectoryPath, "server");
diff --git a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj
index 7c23f9341..fb889e4f2 100644
--- a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj
+++ b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj
@@ -239,163 +239,163 @@
<Content Include="CORE_RL_zlib_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_bgr_.dll">
+ <Content Include="IM_MOD_RL_bgr_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_bmp_.dll">
+ <Content Include="IM_MOD_RL_bmp_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_caption_.dll">
+ <Content Include="IM_MOD_RL_caption_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_clipboard_.dll">
+ <Content Include="IM_MOD_RL_clipboard_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_clip_.dll">
+ <Content Include="IM_MOD_RL_clip_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_cmyk_.dll">
+ <Content Include="IM_MOD_RL_cmyk_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_cut_.dll">
+ <Content Include="IM_MOD_RL_cut_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_dib_.dll">
+ <Content Include="IM_MOD_RL_dib_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_emf_.dll">
+ <Content Include="IM_MOD_RL_emf_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_gif_.dll">
+ <Content Include="IM_MOD_RL_gif_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_gradient_.dll">
+ <Content Include="IM_MOD_RL_gradient_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_gray_.dll">
+ <Content Include="IM_MOD_RL_gray_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_hdr_.dll">
+ <Content Include="IM_MOD_RL_hdr_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_histogram_.dll">
+ <Content Include="IM_MOD_RL_histogram_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_html_.dll">
+ <Content Include="IM_MOD_RL_html_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_icon_.dll">
+ <Content Include="IM_MOD_RL_icon_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_info_.dll">
+ <Content Include="IM_MOD_RL_info_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_jpeg_.dll">
+ <Content Include="IM_MOD_RL_jpeg_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_json_.dll">
+ <Content Include="IM_MOD_RL_json_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_label_.dll">
+ <Content Include="IM_MOD_RL_label_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_magick_.dll">
+ <Content Include="IM_MOD_RL_magick_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_map_.dll">
+ <Content Include="IM_MOD_RL_map_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_mask_.dll">
+ <Content Include="IM_MOD_RL_mask_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_matte_.dll">
+ <Content Include="IM_MOD_RL_matte_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_mat_.dll">
+ <Content Include="IM_MOD_RL_mat_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_meta_.dll">
+ <Content Include="IM_MOD_RL_meta_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_miff_.dll">
+ <Content Include="IM_MOD_RL_miff_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_mono_.dll">
+ <Content Include="IM_MOD_RL_mono_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_mpeg_.dll">
+ <Content Include="IM_MOD_RL_mpeg_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_null_.dll">
+ <Content Include="IM_MOD_RL_null_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_pattern_.dll">
+ <Content Include="IM_MOD_RL_pattern_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_pdf_.dll">
+ <Content Include="IM_MOD_RL_pdf_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_png_.dll">
+ <Content Include="IM_MOD_RL_png_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_preview_.dll">
+ <Content Include="IM_MOD_RL_preview_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_ps2_.dll">
+ <Content Include="IM_MOD_RL_ps2_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_ps3_.dll">
+ <Content Include="IM_MOD_RL_ps3_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_psd_.dll">
+ <Content Include="IM_MOD_RL_psd_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_ps_.dll">
+ <Content Include="IM_MOD_RL_ps_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_raw_.dll">
+ <Content Include="IM_MOD_RL_raw_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_rgb_.dll">
+ <Content Include="IM_MOD_RL_rgb_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_screenshot_.dll">
+ <Content Include="IM_MOD_RL_screenshot_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_thumbnail_.dll">
+ <Content Include="IM_MOD_RL_thumbnail_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_tiff_.dll">
+ <Content Include="IM_MOD_RL_tiff_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_tile_.dll">
+ <Content Include="IM_MOD_RL_tile_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_ttf_.dll">
+ <Content Include="IM_MOD_RL_ttf_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_txt_.dll">
+ <Content Include="IM_MOD_RL_txt_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_url_.dll">
+ <Content Include="IM_MOD_RL_url_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_uyvy_.dll">
+ <Content Include="IM_MOD_RL_uyvy_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_wbmp_.dll">
+ <Content Include="IM_MOD_RL_wbmp_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_webp_.dll">
+ <Content Include="IM_MOD_RL_webp_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_wmf_.dll">
+ <Content Include="IM_MOD_RL_wmf_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_xps_.dll">
+ <Content Include="IM_MOD_RL_xps_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="ImageMagickCoders\x86\IM_MOD_RL_yuv_.dll">
+ <Content Include="IM_MOD_RL_yuv_.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Resources\Images\Icon.ico" />
@@ -455,6 +455,9 @@
<Name>MediaBrowser.XbmcMetadata</Name>
</ProjectReference>
</ItemGroup>
+ <ItemGroup>
+ <Folder Include="ImageMagickCoders\x86\" />
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>