aboutsummaryrefslogtreecommitdiff
path: root/Emby.Drawing/ImageProcessor.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Emby.Drawing/ImageProcessor.cs')
-rw-r--r--Emby.Drawing/ImageProcessor.cs12
1 files changed, 10 insertions, 2 deletions
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<string, string>(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<string, string>(originalImagePath, MimeTypes.GetMimeType(originalImagePath));
}
finally
{
@@ -269,8 +279,6 @@ namespace Emby.Drawing
semaphore.Release();
}
-
- return new Tuple<string, string>(cacheFilePath, GetMimeType(outputFormat, cacheFilePath));
}
private string GetMimeType(ImageFormat format, string path)