Added Imagesharp to the website stuff

This commit is contained in:
Bjarke Berg
2020-02-24 11:26:34 +01:00
parent 5517186cb7
commit 1d6e423b98
9 changed files with 29 additions and 51 deletions

View File

@@ -5,14 +5,14 @@ namespace Umbraco.Web.BackOffice.AspNetCore
{
public static class UmbracoBackOfficeApplicationBuilderExtensions
{
public static IApplicationBuilder UseUmbracoBackOffice(this IApplicationBuilder builder)
public static IApplicationBuilder UseUmbracoBackOffice(this IApplicationBuilder app)
{
if (builder == null)
if (app == null)
{
throw new ArgumentNullException(nameof(builder));
throw new ArgumentNullException(nameof(app));
}
return builder.UseMiddleware<UmbracoBackOfficeMiddleware>();
return app;
}
}
}

View File

@@ -1,21 +0,0 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
namespace Umbraco.Web.BackOffice.AspNetCore
{
public class UmbracoBackOfficeMiddleware
{
private readonly RequestDelegate _next;
public UmbracoBackOfficeMiddleware(RequestDelegate next)
{
_next = next;
}
public async Task InvokeAsync(HttpContext context)
{
// Call the next delegate/middleware in the pipeline
await _next(context);
}
}
}

View File

@@ -13,7 +13,9 @@ namespace Umbraco.Web.UI.BackOffice
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
CreateHostBuilder(args)
.Build()
.Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>

View File

@@ -10,4 +10,8 @@
<ProjectReference Include="..\Umbraco.Web.Website\Umbraco.Web.Website.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="wwwroot\Media" />
</ItemGroup>
</Project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

View File

@@ -1,18 +1,24 @@
using System;
using Microsoft.AspNetCore.Builder;
using SixLabors.ImageSharp.Web.DependencyInjection;
namespace Umbraco.Web.Website.AspNetCore
{
public static class UmbracoBackOfficeApplicationBuilderExtensions
{
public static IApplicationBuilder UseUmbracoWebsite(this IApplicationBuilder builder)
public static IApplicationBuilder UseUmbracoWebsite(this IApplicationBuilder app)
{
if (builder == null)
if (app == null)
{
throw new ArgumentNullException(nameof(builder));
throw new ArgumentNullException(nameof(app));
}
return builder.UseMiddleware<UmbracoWebsiteMiddleware>();
// Important we handle image manipulations before the static files, otherwise the querystring is just ignored.
app.UseImageSharp();
app.UseStaticFiles();
return app;
}
}
}

View File

@@ -1,21 +0,0 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
namespace Umbraco.Web.Website.AspNetCore
{
public class UmbracoWebsiteMiddleware
{
private readonly RequestDelegate _next;
public UmbracoWebsiteMiddleware(RequestDelegate next)
{
_next = next;
}
public async Task InvokeAsync(HttpContext context)
{
// Call the next delegate/middleware in the pipeline
await _next(context);
}
}
}

View File

@@ -1,4 +1,5 @@
using Microsoft.Extensions.DependencyInjection;
using SixLabors.ImageSharp.Web.DependencyInjection;
namespace Umbraco.Web.Website.AspNetCore
{
@@ -6,6 +7,9 @@ namespace Umbraco.Web.Website.AspNetCore
{
public static IServiceCollection AddUmbracoWebsite(this IServiceCollection services)
{
services.AddImageSharp();
return services;
}

View File

@@ -10,4 +10,8 @@
<ProjectReference Include="..\Umbraco.Core\Umbraco.Core.csproj" />
<ProjectReference Include="..\Umbraco.Infrastructure\Umbraco.Infrastructure.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="SixLabors.ImageSharp.Web" Version="1.0.0-beta0009" />
</ItemGroup>
</Project>