Clean up
This commit is contained in:
@@ -16,6 +16,13 @@ namespace Umbraco.Web.Website.AspNetCore
|
||||
public static class UmbracoBackOfficeServiceCollectionExtensions
|
||||
{
|
||||
public static IServiceCollection AddUmbracoWebsite(this IServiceCollection services)
|
||||
{
|
||||
services.AddUmbracoImageSharp();
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
public static IServiceCollection AddUmbracoImageSharp(this IServiceCollection services)
|
||||
{
|
||||
services.AddImageSharpCore(
|
||||
options =>
|
||||
@@ -37,8 +44,7 @@ namespace Umbraco.Web.Website.AspNetCore
|
||||
.SetMemoryAllocator(provider => ArrayPoolMemoryAllocator.CreateWithMinimalPooling())
|
||||
.Configure<PhysicalFileSystemCacheOptions>(options =>
|
||||
{
|
||||
options.CacheFolder = "is-cache";
|
||||
|
||||
options.CacheFolder = "../app_data/cache";
|
||||
})
|
||||
.SetCache<PhysicalFileSystemCache>()
|
||||
.SetCacheHash<CacheHash>()
|
||||
@@ -47,7 +53,6 @@ namespace Umbraco.Web.Website.AspNetCore
|
||||
.AddProcessor<FormatWebProcessor>()
|
||||
.AddProcessor<BackgroundColorWebProcessor>();
|
||||
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
@@ -66,23 +71,4 @@ namespace Umbraco.Web.Website.AspNetCore
|
||||
}
|
||||
}
|
||||
|
||||
public class UmbracoResizeWebProcessor : ResizeWebProcessor
|
||||
{
|
||||
|
||||
public new FormattedImage Process(FormattedImage image, ILogger logger, IDictionary<string, string> commands)
|
||||
{
|
||||
if(commands.TryGetValue("width", out var command))
|
||||
{
|
||||
if (int.TryParse(command, out var width))
|
||||
{
|
||||
if (width > 5000)
|
||||
{
|
||||
commands.Remove("width");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Process(image, logger, commands);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user