我目前正在评估 ImageFlow Server (https://github.com/imazen/imageflow-dotnet-server),以确定它是否能够满足我正在处理的项目的需求。通过阅读文档,我能够使用以下命令将 ImageFlow Server 连接到 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
});
关于imageresizer - 将 ImageFlow Server 与多个 Azure 容器结合使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65803261/