Remove allowSlowMethods from image processing
This commit is contained in:
parent
9a7a5ef50e
commit
449dd1a6a2
|
@ -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>
|
||||
|
|
|
@ -181,7 +181,7 @@ namespace Emby.Photos
|
|||
|
||||
try
|
||||
{
|
||||
var size = _imageProcessor.GetImageSize(item, img, false, false);
|
||||
var size = _imageProcessor.GetImageSize(item, img, false);
|
||||
|
||||
if (size.Width > 0 && size.Height > 0)
|
||||
{
|
||||
|
|
|
@ -328,7 +328,7 @@ namespace MediaBrowser.Api.Images
|
|||
var fileInfo = _fileSystem.GetFileInfo(info.Path);
|
||||
length = fileInfo.Length;
|
||||
|
||||
var size = _imageProcessor.GetImageSize(item, info, true, true);
|
||||
var size = _imageProcessor.GetImageSize(item, info, true);
|
||||
|
||||
width = Convert.ToInt32(size.Width);
|
||||
height = Convert.ToInt32(size.Height);
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace MediaBrowser.Controller.Drawing
|
|||
/// <returns>ImageSize.</returns>
|
||||
ImageSize GetImageSize(BaseItem item, ItemImageInfo info);
|
||||
|
||||
ImageSize GetImageSize(BaseItem item, ItemImageInfo info, bool allowSlowMethods, bool updateItem);
|
||||
ImageSize GetImageSize(BaseItem item, ItemImageInfo info, bool updateItem);
|
||||
|
||||
/// <summary>
|
||||
/// Adds the parts.
|
||||
|
|
Loading…
Reference in New Issue
Block a user