Skip to content

Latest commit

 

History

History
62 lines (48 loc) · 1.88 KB

README.md

File metadata and controls

62 lines (48 loc) · 1.88 KB

Elmahdi.Phone

Nuget downloads GitHub license

An Image provider for Six Labors ImageSharp.Web

This provider allows the processing and serving of image files from Amazon S3 or DigitalOcean Spaces and is available as an external package installable via NuGet.

Installation

PM> Install-Package Elmahdi.ImageSharp.Web.Providers.S3 -Version VERSION_NUMBER
> dotnet add package Elmahdi.ImageSharp.Web.Providers.S3 --version VERSION_NUMBER

Usage

Once installed the provider AzureBlobContainerClientOptions can be configured as follows:

using Elmahdi.ImageSharp.Web.Providers.S3.Providers;
using SixLabors.ImageSharp.Web.DependencyInjection;

public void ConfigureServices(IServiceCollection services)
{
    ...
    services
        .AddImageSharp()
        .Configure<S3StorageImageProviderOptions>(options => { 
            options.S3Containers.Add(new S3ClientOptions { 
                AccessKeyId = "", // Access Key Id
                SecretAccessKey = "", // Secret Access Key
                BucketName = "", // Bucket Name, 
                EndpointUrl = "" // Endpoint Url            
            }); 
        })
        .ClearProviders()
        .AddProvider<S3StorageImageProvider>();
}

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
    ...
    app.UseImageSharp(); // Add this BEFORE app.UseStaticFiles();
    ...
}

Url requests are matched in accordance to the following rule:

/{BucketName}/{FileName}

To do

  • Add tests