コード例 #1
0
        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();
            }
        }
コード例 #2
0
        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();
                }
            }
        }