将 ImageFlow 服务器与多个 Azure 容器一起使用

Using ImageFlow Server with multiple Azure Containers

我目前正在评估 ImageFlow Server (https://github.com/imazen/imageflow-dotnet-server) 以确定它是否能满足我正在进行的项目的需要。通过文档,我能够使用以下方法将 ImageFlow 服务器连接到 Azure 存储:

    public void ConfigureServices(IServiceCollection services)
    {
        services.AddImageflowAzureBlobService(
            new AzureBlobServiceOptions("[MY CONNECTION STRING TO AZURE STORAGE]",
                    new BlobClientOptions())
                .MapPrefix("/azure", "[CONTAINER No. 1]"));
    }

这没有问题,我可以按预期看到图像。该项目的当前要求要求每个用户都有一个唯一的容器,这使得上述实现成为不可能。

有没有办法在发出请求时将容器名称与文件名一起传递?类似于:'/azure/CONTAINER/image.jpg?w=250'

我们有一个示例提供商可以在此处执行此操作:https://github.com/imazen/imageflow-dotnet-server/blob/main/examples/Imageflow.Server.Example/CustomBlobService.cs

// Custom blob services can do whatever you need. See CustomBlobService.cs in src/Imageflow.Service.Example
            services.AddImageflowCustomBlobService(new CustomBlobServiceOptions()
            {
                Prefix = "/custom_blobs/",
                IgnorePrefixCase = true,
                ConnectionString = "UseDevelopmentStorage=true;",
                // Only allow 'my_container' to be accessed. /custom_blobs/my_container/key.jpg would be an example path.
                ContainerKeyFilterFunction = (container, key) =>
                    container == "my_container" ? Tuple.Create(container, key) : null
            });