mirror of https://github.com/jellyfin/jellyfin.git
Co-authored-by: Shadowghost <Shadowghost@users.noreply.github.com>
This commit is contained in:
parent
15c8854502
commit
3c22d5c970
|
@ -1885,7 +1885,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Cannot get image dimensions for {ImagePath}", image.Path);
|
_logger.LogError(ex, "Cannot get image dimensions for {ImagePath}", image.Path);
|
||||||
size = new ImageDimensions(0, 0);
|
size = default;
|
||||||
image.Width = 0;
|
image.Width = 0;
|
||||||
image.Height = 0;
|
image.Height = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,8 +120,18 @@ public class SkiaEncoder : IImageEncoder
|
||||||
if (extension.Equals(".svg", StringComparison.OrdinalIgnoreCase))
|
if (extension.Equals(".svg", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
var svg = new SKSvg();
|
var svg = new SKSvg();
|
||||||
svg.Load(path);
|
try
|
||||||
return new ImageDimensions(Convert.ToInt32(svg.Picture.CullRect.Width), Convert.ToInt32(svg.Picture.CullRect.Height));
|
{
|
||||||
|
svg.Load(path);
|
||||||
|
return new ImageDimensions(Convert.ToInt32(svg.Picture.CullRect.Width), Convert.ToInt32(svg.Picture.CullRect.Height));
|
||||||
|
}
|
||||||
|
catch (FormatException skiaColorException)
|
||||||
|
{
|
||||||
|
// This exception is known to be thrown on vector images that define custom styles
|
||||||
|
// Skia SVG is not able to handle that and as the repository is quite stale and has not received updates we just catch them
|
||||||
|
_logger.LogDebug(skiaColorException, "There was a issue loading the requested svg file");
|
||||||
|
return default;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
using var codec = SKCodec.Create(path, out SKCodecResult result);
|
using var codec = SKCodec.Create(path, out SKCodecResult result);
|
||||||
|
@ -132,10 +142,10 @@ public class SkiaEncoder : IImageEncoder
|
||||||
return new ImageDimensions(info.Width, info.Height);
|
return new ImageDimensions(info.Width, info.Height);
|
||||||
case SKCodecResult.Unimplemented:
|
case SKCodecResult.Unimplemented:
|
||||||
_logger.LogDebug("Image format not supported: {FilePath}", path);
|
_logger.LogDebug("Image format not supported: {FilePath}", path);
|
||||||
return new ImageDimensions(0, 0);
|
return default;
|
||||||
default:
|
default:
|
||||||
_logger.LogError("Unable to determine image dimensions for {FilePath}: {SkCodecResult}", path, result);
|
_logger.LogError("Unable to determine image dimensions for {FilePath}: {SkCodecResult}", path, result);
|
||||||
return new ImageDimensions(0, 0);
|
return default;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue