move image magick files
This commit is contained in:
parent
3788033dcd
commit
23a062103a
|
@ -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>
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue
Block a user