Share via


BrowserFileExtensions.RequestImageFileAsync Method

Definition

Attempts to convert the current image file to a new one of the specified file type and maximum file dimensions.

Caution: there is no guarantee that the file will be converted, or will even be a valid image file at all, either before or after conversion. The conversion is requested within the browser before it is transferred to .NET code, so the resulting data should be treated as untrusted.

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)

Parameters

browserFile
IBrowserFile

The IBrowserFile to convert to a new image file.

format
String

The new image format.

maxWithmaxWidth
Int32

The maximum image width.

maxHeight
Int32

The maximum image height

Returns

A ValueTask representing the completion of the operation.

Remarks

The image will be scaled to fit the specified dimensions while preserving the original aspect ratio.

Applies to