private static IImageInfo GetImageInfoFromBase64(string base64) { var bytes = EncodingHelpers.ConvertBase64ToBytes(base64); var imageInfo = Image.Identify(bytes); if (imageInfo is null) { throw new Exception("Image Info detector not suitable for image."); } return(imageInfo); }
public async Task UploadImage(string data, string container, string blobName, CancellationToken cancellationToken = default) { var bytes = EncodingHelpers.ConvertBase64ToBytes(data); using var imageContext = Image.Load(bytes); var resizedImage = ModifyImage(imageContext); var imageStream = await SaveImageAsJpeg(resizedImage, cancellationToken); await _storageService.SaveAsync( stream : imageStream, bucket : _storageSettings.Bucket, container : container, blobName : blobName, metadata : null, cancellationToken : cancellationToken); }