Targeting .NET 10 and Optimizely CMS 13
Package now uses:
- SixLabors.ImageSharp 3.1.12+
- SixLabors.ImageSharp.Web 3.2.0
- SixLabors.ImageSharp.Web.Providers.Azure 3.2.0
Targeting .NET 10 and Optimizely CMS 12
Support for URL signing of image processing requests.
Package uses:
- SixLabors.ImageSharp 3.1.12+
- SixLabors.ImageSharp.Web 3.2.0
- SixLabors.ImageSharp.Web.Providers.Azure 3.2.0
Package now uses:
- SixLabors.ImageSharp 3.1.4
- SixLabors.ImageSharp.Web 3.1.2
- SixLabors.ImageSharp.Web.Providers.Azure 3.1.2
Targeting .NET 8
Package now uses: SixLabors.ImageSharp Version="3.1.3" SixLabors.ImageSharp.Web Version="3.1.1" SixLabors.ImageSharp.Web.Providers.Azure Version="3.1.1"
Package now uses SixLabors.ImageSharp 3.0.2 and SixLabors.ImageSharp.Web 3.0.1. Package now also references SixLabors.ImageSharp.Web.Providers.Azure
Package now uses SixLabors.ImageSharp 3.0.1 and SixLabors.ImageSharp.Web 3.0.1
- Baaijte.Optimizely.ImageSharp.Web is licensed under the Apache License, Version 2.0
- This package is supported in a best effort sense
Note As of version 2.0.0 this package targets .NET6.0 and Optimizely.CMS.Core version 12.5.0 or higher
Baaijte.OptimizelyImageSharp.Web is installed via the Optimizely NuGet feed
PM > Install-Package Baaijte.Optimizely.ImageSharp.Web -Version VERSION_NUMBERdotnet add package Baaijte.Optimizely.ImageSharp.Web --version VERSION_NUMBER
Once installed you will need to add the following code to ConfigureServices and Configure in your Startup.cs file.
This installs the the default service and options.
public void ConfigureServices(IServiceCollection services) {
// Add the default service and options.
services.AddBaaijteOptimizelyImageSharp();
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) {
// Add the image processing middleware.
app.UseBaaijteOptimizelyImageSharp();
}DO NOT add other SixLabors.ImageSharp.Web settings!!
Also add using Baaijte.Optimizely.ImageSharp.Web; at the top of your Startup.cs file if it was not automatically added.
public void ConfigureServices(IServiceCollection services) {
services.AddImageSharp()
.Configure<AzureBlobStorageCacheOptions>(options =>
{
options.ConnectionString = _configuration.GetConnectionString("EPiServerAzureBlobs");
options.ContainerName = "mysitemedia";
})
.ClearProviders()
.AddProvider<BlobImageProvider>()
.SetCache<AzureBlobStorageCache>();
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) {
// Add the image processing middleware.
app.UseBaaijteOptimizelyImageSharp();
}The package can optionally require that the image url is "signed" with a hash value.
This prevents that someone can generate massive expensive image processing requests, which could potentially overload your server.
- A hash value is generated by combinine a secrets salt with the raw path and query string of the image request URL.
- The hash valus is added as a query parameter
hto the image processing URL. - The CMS server validates incoming image processing requests by recomputing the hash value and comparing it to the
hvalue in the request. - Image processing requests without a valid
hvalue return403
Add the signing options to your configuration:
services.AddImageRequestSigning(new ImageRequestSigningOptions
{
Salt = "your-shared-secret-salt"
});The delivery server must use the same salt and the same hash algorithm.
- SHA-256
- lowercase hex output
Example:
The SHA-256 hash of "your-shared-secret-salt" + "/globalassets/test.jpg?width=400" is 72d1f49d43ec4acbfb6653df6ada83dc6dd61221e4c3d724fdebaf748d611b3a