exposed GetEnhancedImage on ImageProcessor

This commit is contained in:
Luke Pulverenti 2013-09-20 11:42:27 -04:00
parent 755d98edc0
commit e50c29ffca
2 changed files with 29 additions and 0 deletions

View File

@ -77,5 +77,14 @@ namespace MediaBrowser.Controller.Drawing
/// <param name="toStream">To stream.</param>
/// <returns>Task.</returns>
Task ProcessImage(ImageProcessingOptions options, Stream toStream);
/// <summary>
/// Gets the enhanced image.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="imageType">Type of the image.</param>
/// <param name="imageIndex">Index of the image.</param>
/// <returns>Task{System.String}.</returns>
Task<string> GetEnhancedImage(BaseItem item, ImageType imageType, int imageIndex);
}
}

View File

@ -539,6 +539,26 @@ namespace MediaBrowser.Server.Implementations.Drawing
return string.Join("|", cacheKeys.ToArray()).GetMD5();
}
/// <summary>
/// Gets the enhanced image.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="imageType">Type of the image.</param>
/// <param name="imageIndex">Index of the image.</param>
/// <returns>Task{System.String}.</returns>
public async Task<string> GetEnhancedImage(BaseItem item, ImageType imageType, int imageIndex)
{
var enhancers = GetSupportedEnhancers(item, imageType).ToList();
var imagePath = item.GetImagePath(imageType, imageIndex);
var dateModified = item.GetImageDateModified(imagePath);
var result = await GetEnhancedImage(imagePath, dateModified, item, imageType, imageIndex, enhancers);
return result.Item1;
}
private async Task<Tuple<string, DateTime>> GetEnhancedImage(string originalImagePath, DateTime dateModified, BaseItem item,
ImageType imageType, int imageIndex,
List<IImageEnhancer> enhancers)