<i id='O4qQ0'><tr id='O4qQ0'><dt id='O4qQ0'><q id='O4qQ0'><span id='O4qQ0'><b id='O4qQ0'><form id='O4qQ0'><ins id='O4qQ0'></ins><ul id='O4qQ0'></ul><sub id='O4qQ0'></sub></form><legend id='O4qQ0'></legend><bdo id='O4qQ0'><pre id='O4qQ0'><center id='O4qQ0'></center></pre></bdo></b><th id='O4qQ0'></th></span></q></dt></tr></i><div id='O4qQ0'><tfoot id='O4qQ0'></tfoot><dl id='O4qQ0'><fieldset id='O4qQ0'></fieldset></dl></div>

  • <small id='O4qQ0'></small><noframes id='O4qQ0'>

    <legend id='O4qQ0'><style id='O4qQ0'><dir id='O4qQ0'><q id='O4qQ0'></q></dir></style></legend>

      <tfoot id='O4qQ0'></tfoot>
      • <bdo id='O4qQ0'></bdo><ul id='O4qQ0'></ul>
      1. 如何使用 Azure Functions 删除 blob?

        时间:2023-10-25

        • <bdo id='gU2fj'></bdo><ul id='gU2fj'></ul>
          <legend id='gU2fj'><style id='gU2fj'><dir id='gU2fj'><q id='gU2fj'></q></dir></style></legend>
          <tfoot id='gU2fj'></tfoot>
          <i id='gU2fj'><tr id='gU2fj'><dt id='gU2fj'><q id='gU2fj'><span id='gU2fj'><b id='gU2fj'><form id='gU2fj'><ins id='gU2fj'></ins><ul id='gU2fj'></ul><sub id='gU2fj'></sub></form><legend id='gU2fj'></legend><bdo id='gU2fj'><pre id='gU2fj'><center id='gU2fj'></center></pre></bdo></b><th id='gU2fj'></th></span></q></dt></tr></i><div id='gU2fj'><tfoot id='gU2fj'></tfoot><dl id='gU2fj'><fieldset id='gU2fj'></fieldset></dl></div>

              <tbody id='gU2fj'></tbody>

                  <small id='gU2fj'></small><noframes id='gU2fj'>

                  本文介绍了如何使用 Azure Functions 删除 blob?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在创建一个 Azure 函数,该函数在图像上传或添加到特定 Azure 存储时触发,它执行以下操作:1.) 调整图像大小2.) 将图像放到正确的目录中(使用输出绑定)3.) 删除处理后添加到 Azure 存储的原始 blob 图像.

                  I am creating an Azure function that triggers when an image is uploaded or added to a particular Azure Storage, and it does the following: 1.) Resize the image 2.) Put the image to correct directory (using Output binding) 3.) Delete the original blob image that was added to Azure Storage after processing.

                  我已完成该过程中的步骤 1 和 2,但我发现几乎没有关于删除 Blob 或 API 的文档会公开 Azure 存储的方法.(使用 C#)

                  I am done with steps 1 and 2 in the process, but I'm finding less to no documentation about deleting a blob or an API that would expose methods for Azure Storage. (Using C#)

                  示例代码如下:

                  #r "System.Drawing"
                  using System;
                  using ImageResizer;
                  using System.Drawing;
                  using System.Drawing.Imaging;
                  
                  public static void Run(Stream inputImage, string imageName, Stream resizedImage, TraceWriter log)
                  {
                      // Log the file name and size
                      log.Info($"C# Blob trigger function Processed blob
                   Name:{imageName} 
                   Size: {inputImage.Length} Bytes");
                  
                      // Manipulate the image
                      var settings = new ImageResizer.ResizeSettings
                      {
                          MaxWidth = 400,
                          Format = "png"
                      };
                  
                      ImageResizer.ImageBuilder.Current.Build(inputImage, resizedImage, settings);
                  
                      // Delete the Raw Original Image Step
                  }
                  

                  推荐答案

                  要删除一个blob,你需要

                  To delete a blob, you need to

                  var container = blobClient.GetContainerReference(containerName);
                  var blockBlob = container.GetBlockBlobReference(fileName);
                  return blockBlob.DeleteIfExists();
                  

                  请确保在尝试此操作之前关闭所有流,以便不再使用该图像.

                  Make sure that your close all streams before you try this so the image is no longer in use.

                  这篇关于如何使用 Azure Functions 删除 blob?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何使用 Rider 或 VS 2017 中的 NUnit、xUnit 或 MSTest 测试 .NET Standar 下一篇:在 .NET 5 中测试 Azure 函数

                  相关文章

                  <small id='KaVK8'></small><noframes id='KaVK8'>

                • <tfoot id='KaVK8'></tfoot>
                • <legend id='KaVK8'><style id='KaVK8'><dir id='KaVK8'><q id='KaVK8'></q></dir></style></legend>
                  • <bdo id='KaVK8'></bdo><ul id='KaVK8'></ul>

                      <i id='KaVK8'><tr id='KaVK8'><dt id='KaVK8'><q id='KaVK8'><span id='KaVK8'><b id='KaVK8'><form id='KaVK8'><ins id='KaVK8'></ins><ul id='KaVK8'></ul><sub id='KaVK8'></sub></form><legend id='KaVK8'></legend><bdo id='KaVK8'><pre id='KaVK8'><center id='KaVK8'></center></pre></bdo></b><th id='KaVK8'></th></span></q></dt></tr></i><div id='KaVK8'><tfoot id='KaVK8'></tfoot><dl id='KaVK8'><fieldset id='KaVK8'></fieldset></dl></div>