public async Task SaveToCdnAsync(Image image, string storageAbsUrl, ImageFormat toFormat) { var provider = new StorageUserImagesProvider(); using (var stream = ImageTypes.ImageToStream(image, toFormat)) { await provider.UploadAsyncByAbsoluteUrlAsync(stream, storageAbsUrl); image.Dispose(); stream.Close(); } }
public async Task SaveToCdnAsync(Dictionary <string, Image> images, ImageFormat toFormat) { var provider = new StorageUserImagesProvider(); foreach (var i in images) { var img = i.Value; using (var stream = ImageTypes.ImageToStream(img, toFormat)) { await provider.UploadAsyncByAbsoluteUrlAsync(stream, i.Key); // img.Dispose(); // stream.Close(); } } }