aboutsummaryrefslogtreecommitdiff
path: root/Emby.Drawing
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2017-06-11 18:05:07 -0400
committerGitHub <noreply@github.com>2017-06-11 18:05:07 -0400
commite0c907cc6009408157d42531afab4c089c2e2871 (patch)
tree069efdd6b11b3dd81e7bc6c191497114374f0577 /Emby.Drawing
parent9ee58d399cde4ccec9ea10c60c1a508a353b7836 (diff)
parente9d2fb13e06a93336b6b16d03b66d3390a762c40 (diff)
Merge pull request #2702 from MediaBrowser/beta
Beta
Diffstat (limited to 'Emby.Drawing')
-rw-r--r--Emby.Drawing/ImageProcessor.cs28
-rw-r--r--Emby.Drawing/NullImageEncoder.cs2
-rw-r--r--Emby.Drawing/project.json17
3 files changed, 14 insertions, 33 deletions
diff --git a/Emby.Drawing/ImageProcessor.cs b/Emby.Drawing/ImageProcessor.cs
index a1543382f2..eb5e0d82a9 100644
--- a/Emby.Drawing/ImageProcessor.cs
+++ b/Emby.Drawing/ImageProcessor.cs
@@ -217,14 +217,23 @@ namespace Emby.Drawing
dateModified = tuple.Item2;
}
- if (options.HasDefaultOptions(originalImagePath))
+ var photo = item as Photo;
+ var autoOrient = false;
+ ImageOrientation? orientation = null;
+ if (photo != null && photo.Orientation.HasValue && photo.Orientation.Value != ImageOrientation.TopLeft)
+ {
+ autoOrient = true;
+ orientation = photo.Orientation;
+ }
+
+ if (options.HasDefaultOptions(originalImagePath) && !autoOrient)
{
// Just spit out the original file if all the options are default
return new Tuple<string, string, DateTime>(originalImagePath, MimeTypes.GetMimeType(originalImagePath), dateModified);
}
ImageSize? originalImageSize = GetSavedImageSize(originalImagePath, dateModified);
- if (originalImageSize.HasValue && options.HasDefaultOptions(originalImagePath, originalImageSize.Value))
+ if (originalImageSize.HasValue && options.HasDefaultOptions(originalImagePath, originalImageSize.Value) && !autoOrient)
{
// Just spit out the original file if all the options are default
_logger.Info("Returning original image {0}", originalImagePath);
@@ -243,7 +252,6 @@ namespace Emby.Drawing
if (!_fileSystem.FileExists(cacheFilePath))
{
- _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(cacheFilePath));
var tmpPath = Path.ChangeExtension(Path.Combine(_appPaths.TempDirectory, Guid.NewGuid().ToString("N")), Path.GetExtension(cacheFilePath));
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(tmpPath));
@@ -252,13 +260,14 @@ namespace Emby.Drawing
item = _libraryManager().GetItemById(options.ItemId);
}
- var resultPath =_imageEncoder.EncodeImage(originalImagePath, dateModified, tmpPath, AutoOrient(item), quality, options, outputFormat);
+ var resultPath = _imageEncoder.EncodeImage(originalImagePath, dateModified, tmpPath, autoOrient, orientation, quality, options, outputFormat);
if (string.Equals(resultPath, originalImagePath, StringComparison.OrdinalIgnoreCase))
{
return new Tuple<string, string, DateTime>(originalImagePath, MimeTypes.GetMimeType(originalImagePath), dateModified);
}
+ _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(cacheFilePath));
CopyFile(tmpPath, cacheFilePath);
return new Tuple<string, string, DateTime>(tmpPath, GetMimeType(outputFormat, cacheFilePath), _fileSystem.GetLastWriteTimeUtc(tmpPath));
@@ -288,17 +297,6 @@ namespace Emby.Drawing
}
}
- private bool AutoOrient(IHasImages item)
- {
- var photo = item as Photo;
- if (photo != null && photo.Orientation.HasValue)
- {
- return true;
- }
-
- return false;
- }
-
//private static int[][] OPERATIONS = new int[][] {
// TopLeft
//new int[] { 0, NONE},
diff --git a/Emby.Drawing/NullImageEncoder.cs b/Emby.Drawing/NullImageEncoder.cs
index 2241c5a868..f04e8aaf1e 100644
--- a/Emby.Drawing/NullImageEncoder.cs
+++ b/Emby.Drawing/NullImageEncoder.cs
@@ -32,7 +32,7 @@ namespace Emby.Drawing
throw new NotImplementedException();
}
- public string EncodeImage(string inputPath, DateTime dateModified, string outputPath, bool autoOrient, int quality, ImageProcessingOptions options, ImageFormat selectedOutputFormat)
+ public string EncodeImage(string inputPath, DateTime dateModified, string outputPath, bool autoOrient, ImageOrientation? orientation, int quality, ImageProcessingOptions options, ImageFormat selectedOutputFormat)
{
throw new NotImplementedException();
}
diff --git a/Emby.Drawing/project.json b/Emby.Drawing/project.json
deleted file mode 100644
index fbbe9eaf32..0000000000
--- a/Emby.Drawing/project.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "frameworks":{
- "netstandard1.6":{
- "dependencies":{
- "NETStandard.Library":"1.6.0",
- }
- },
- ".NETPortable,Version=v4.5,Profile=Profile7":{
- "buildOptions": {
- "define": [ ]
- },
- "frameworkAssemblies":{
-
- }
- }
- }
-} \ No newline at end of file