File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33This library allows one to save bandwidth or API calls by caching images locally in a cache folder.
44
55## Video Demonstration
6- ![ Demonstration video showing load times.] ( https://github.com/soyfrien/ImageCache/raw/main/ImageCacheDemo.mp4 )
6+ ![ Demonstration GIF showing load times.] ( https://github.com/soyfrien/ImageCache/raw/main/ImageCacheDemo.gif )
77
88* Notice the instant load times for this CollectionView of web images.*
99
@@ -54,6 +54,16 @@ Page(ViewModel viewModel, ImageCache imageCache)
5454 ...
5555```
5656### Helper Helping Out However Examples
57+ With the flexible IImage:
58+ ```
59+ #if WINDOWS
60+ Microsoft.Maui.Graphics.IImage? image = new W2DImageLoadingService().FromStream(await _imageCache.GetAsStreamAsync(new Uri("https://example.com/e.jpg")));
61+ // Microsoft.Maui.Graphics.IImage? image = new W2DImageLoadingService().FromStream(_imageCache.GetAsStreamAsync(new Uri("https://example.com/e.jpg")).Result);
62+ #elif IOS || ANDROID || MACCATALYST
63+ Microsoft.Maui.Graphics.IImage image = PlatformImage.FromStream(_imageCache.GetAsStreamAsync(new Uri("https://example.com/e.jpg")).Result);
64+ #endif
65+ ```
66+
5767You have an [ Microsoft.Maui.Controls.Image] ( https://learn.microsoft.com/en-us/dotnet/maui/user-interface/controls/image ) that you currently pass a URL string into the ` Source ` property, instead of passing the string do something like:
5868```
5969Source = await ImageCache.GetAsImageSourceAsync("https://www.example.com/image.png");
@@ -106,4 +116,4 @@ Contributions Are Appreciated and Welcome
106116
107117Bugs and Issues
108118--------------------------------------------
109- * Please report any issues you find, old or new: https://github.com/soyfrien/ImageCache/issues.
119+ * Please report any issues you find, old or new: https://github.com/soyfrien/ImageCache/issues .
You can’t perform that action at this time.
0 commit comments