BrowserFileExtensions.RequestImageFileAsync(IBrowserFile, String, Int32, Int32) 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);
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)

Parameters

browserFile
IBrowserFile

The IBrowserFile to convert to a new image file.

format
String

The new image format.

maxWith
Int32

The maximum image width.

maxHeight
Int32

The maximum image height

Returns

ValueTask<IBrowserFile>

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