added new parent methods

This commit is contained in:
Luke Pulverenti
2015-11-11 09:56:31 -05:00
parent db8e51edb6
commit cc19ce0daf
48 changed files with 189 additions and 143 deletions

View File

@@ -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)