aboutsummaryrefslogtreecommitdiff
path: root/Emby.Drawing/ImageProcessor.cs
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2017-05-10 15:15:14 -0400
committerGitHub <noreply@github.com>2017-05-10 15:15:14 -0400
commit6ee9da3717a563d110fc56c93478885d19449cce (patch)
treef353dec0ac06811918b33f6deed4e7fbe3c27935 /Emby.Drawing/ImageProcessor.cs
parent06a1393abed20137844f062e44cf8ae7feb9e8f6 (diff)
parentb9baf377e81e454438d9faad1b1b793a719bb667 (diff)
Merge pull request #2628 from MediaBrowser/dev
Dev
Diffstat (limited to 'Emby.Drawing/ImageProcessor.cs')
-rw-r--r--Emby.Drawing/ImageProcessor.cs56
1 files changed, 0 insertions, 56 deletions
diff --git a/Emby.Drawing/ImageProcessor.cs b/Emby.Drawing/ImageProcessor.cs
index bee0e9b69..accabcf14 100644
--- a/Emby.Drawing/ImageProcessor.cs
+++ b/Emby.Drawing/ImageProcessor.cs
@@ -136,14 +136,6 @@ namespace Emby.Drawing
}
}
- private string CroppedWhitespaceImageCachePath
- {
- get
- {
- return Path.Combine(_appPaths.ImageCachePath, "cropped-images");
- }
- }
-
public void AddParts(IEnumerable<IImageEnhancer> enhancers)
{
ImageEnhancers = enhancers.ToArray();
@@ -186,14 +178,6 @@ namespace Emby.Drawing
return new Tuple<string, string, DateTime>(originalImagePath, MimeTypes.GetMimeType(originalImagePath), dateModified);
}
- if (options.CropWhiteSpace && _imageEncoder.SupportsImageEncoding)
- {
- var tuple = await GetWhitespaceCroppedImage(originalImagePath, dateModified).ConfigureAwait(false);
-
- originalImagePath = tuple.Item1;
- dateModified = tuple.Item2;
- }
-
if (options.Enhancers.Count > 0)
{
var tuple = await GetEnhancedImage(new ItemImageInfo
@@ -400,46 +384,6 @@ namespace Emby.Drawing
return requestedFormat;
}
- /// <summary>
- /// Crops whitespace from an image, caches the result, and returns the cached path
- /// </summary>
- private async Task<Tuple<string, DateTime>> GetWhitespaceCroppedImage(string originalImagePath, DateTime dateModified)
- {
- var name = originalImagePath;
- name += "datemodified=" + dateModified.Ticks;
-
- var croppedImagePath = GetCachePath(CroppedWhitespaceImageCachePath, name, Path.GetExtension(originalImagePath));
-
- // Check again in case of contention
- if (_fileSystem.FileExists(croppedImagePath))
- {
- return GetResult(croppedImagePath);
- }
-
- try
- {
- _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(croppedImagePath));
- var tmpPath = Path.ChangeExtension(Path.Combine(_appPaths.TempDirectory, Guid.NewGuid().ToString("N")), Path.GetExtension(croppedImagePath));
- _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(tmpPath));
-
- _imageEncoder.CropWhiteSpace(originalImagePath, tmpPath);
- CopyFile(tmpPath, croppedImagePath);
- return GetResult(tmpPath);
- }
- catch (NotImplementedException)
- {
- // No need to spam the log with an error message
- return new Tuple<string, DateTime>(originalImagePath, dateModified);
- }
- catch (Exception ex)
- {
- // We have to have a catch-all here because some of the .net image methods throw a plain old Exception
- _logger.ErrorException("Error cropping image {0}", ex, originalImagePath);
-
- return new Tuple<string, DateTime>(originalImagePath, dateModified);
- }
- }
-
private Tuple<string, DateTime> GetResult(string path)
{
return new Tuple<string, DateTime>(path, _fileSystem.GetLastWriteTimeUtc(path));