v10: Update to ImageSharp v2 (#12185)
* Update to ImageSharp 2.1.0 and ImageSharp.Web 2.0.0-alpha.0.23 * Rename CachedNameLength to CacheHashLength and add CacheFolderDepth setting * Replace PhysicalFileSystemProvider with WebRootImageProvider * Support EXIF-orientation in image dimention extractor * Remove virtual methods on FileProviderImageProvider * Simplify FileInfoImageResolver * Update to SixLabors.ImageSharp.Web 2.0.0-alpha.0.25 and remove custom providers * Make CropWebProcessor EXIF orientation-aware * Improve width/height sanitization * Also use 'v' as cache buster value * Add WebP to supported image file types * Update to SixLabors.ImageSharp.Web 2.0.0-alpha.0.27 and fix test * Fix rounding error and add test cases * Update to newest and stable releases * Move ImageSharpImageUrlGenerator to Umbraco.Web.Common * Use IConfigureOptions to configure ImageSharp options * Implement IEquatable on ImageUrlGenerationOptions classes * Fix empty/null values in image URL generation and corresponding tests * Use IsSupportedImageFormat extension method * Remove unneeded reflection
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Options;
|
||||
using SixLabors.ImageSharp.Web.Caching;
|
||||
using Umbraco.Cms.Core.Configuration.Models;
|
||||
using Umbraco.Cms.Core.Extensions;
|
||||
|
||||
namespace Umbraco.Cms.Web.Common.DependencyInjection
|
||||
{
|
||||
/// <summary>
|
||||
/// Configures the ImageSharp physical file system cache options.
|
||||
/// </summary>
|
||||
/// <seealso cref="IConfigureOptions{PhysicalFileSystemCacheOptions}" />
|
||||
public sealed class ConfigurePhysicalFileSystemCacheOptions : IConfigureOptions<PhysicalFileSystemCacheOptions>
|
||||
{
|
||||
private readonly ImagingSettings _imagingSettings;
|
||||
private readonly IHostEnvironment _hostEnvironment;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ConfigurePhysicalFileSystemCacheOptions" /> class.
|
||||
/// </summary>
|
||||
/// <param name="imagingSettings">The Umbraco imaging settings.</param>
|
||||
/// <param name="hostEnvironment">The host environment.</param>
|
||||
public ConfigurePhysicalFileSystemCacheOptions(IOptions<ImagingSettings> imagingSettings, IHostEnvironment hostEnvironment)
|
||||
{
|
||||
_imagingSettings = imagingSettings.Value;
|
||||
_hostEnvironment = hostEnvironment;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Configure(PhysicalFileSystemCacheOptions options)
|
||||
{
|
||||
options.CacheFolder = _hostEnvironment.MapPathContentRoot(_imagingSettings.Cache.CacheFolder);
|
||||
options.CacheFolderDepth = _imagingSettings.Cache.CacheFolderDepth;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user