BrowserFileExtensions.RequestImageFileAsync 方法

定義

嘗試將目前的影像檔轉換為新的其中一個指定的檔案類型和最大檔案維度。

注意:不保證檔案會轉換,或甚至會是轉換前後的有效影像檔。 在傳送至 .NET 程式碼之前,會在瀏覽器中要求轉換,因此產生的資料應該視為不受信任。

public:
[System::Runtime::CompilerServices::Extension]
 static System::Threading::Tasks::ValueTask<Microsoft::AspNetCore::Components::Forms::IBrowserFile ^> RequestImageFileAsync(Microsoft::AspNetCore::Components::Forms::IBrowserFile ^ browserFile, System::String ^ format, int maxWith, int maxHeight);
public static System.Threading.Tasks.ValueTask<Microsoft.AspNetCore.Components.Forms.IBrowserFile> RequestImageFileAsync (this Microsoft.AspNetCore.Components.Forms.IBrowserFile browserFile, string format, int maxWith, int maxHeight);
public static System.Threading.Tasks.ValueTask<Microsoft.AspNetCore.Components.Forms.IBrowserFile> RequestImageFileAsync (this Microsoft.AspNetCore.Components.Forms.IBrowserFile browserFile, string format, int maxWidth, int maxHeight);
static member RequestImageFileAsync : Microsoft.AspNetCore.Components.Forms.IBrowserFile * string * int * int -> System.Threading.Tasks.ValueTask<Microsoft.AspNetCore.Components.Forms.IBrowserFile>
static member RequestImageFileAsync : Microsoft.AspNetCore.Components.Forms.IBrowserFile * string * int * int -> System.Threading.Tasks.ValueTask<Microsoft.AspNetCore.Components.Forms.IBrowserFile>
<Extension()>
Public Function RequestImageFileAsync (browserFile As IBrowserFile, format As String, maxWith As Integer, maxHeight As Integer) As ValueTask(Of IBrowserFile)
<Extension()>
Public Function RequestImageFileAsync (browserFile As IBrowserFile, format As String, maxWidth As Integer, maxHeight As Integer) As ValueTask(Of IBrowserFile)

參數

browserFile
IBrowserFile

IBrowserFile要轉換成新影像檔的 。

format
String

新的影像格式。

maxWithmaxWidth
Int32

影像寬度上限。

maxHeight
Int32

最大影像高度

傳回

ValueTask 表示作業完成。

備註

影像會調整為符合指定的維度,同時保留原始外觀比例。

適用於