From cc19ce0daf3edb46d1acffdf2af98787cc9f7f5a Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 11 Nov 2015 09:56:31 -0500 Subject: added new parent methods --- Emby.Drawing/ImageProcessor.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'Emby.Drawing/ImageProcessor.cs') diff --git a/Emby.Drawing/ImageProcessor.cs b/Emby.Drawing/ImageProcessor.cs index 902ade448..e1b92bbff 100644 --- a/Emby.Drawing/ImageProcessor.cs +++ b/Emby.Drawing/ImageProcessor.cs @@ -259,6 +259,16 @@ namespace Emby.Drawing _imageEncoder.EncodeImage(originalImagePath, cacheFilePath, newWidth, newHeight, quality, options, outputFormat); } + + return new Tuple(cacheFilePath, GetMimeType(outputFormat, cacheFilePath)); + } + catch (Exception ex) + { + // If it fails for whatever reason, return the original image + _logger.ErrorException("Error encoding image", ex); + + // Just spit out the original file if all the options are default + return new Tuple(originalImagePath, MimeTypes.GetMimeType(originalImagePath)); } finally { @@ -269,8 +279,6 @@ namespace Emby.Drawing semaphore.Release(); } - - return new Tuple(cacheFilePath, GetMimeType(outputFormat, cacheFilePath)); } private string GetMimeType(ImageFormat format, string path) -- cgit v1.2.3