Skip to content

Commit 9a6997d

Browse files
authored
Update README.md
1 parent db1acfb commit 9a6997d

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
This 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+
5767
You 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
```
5969
Source = await ImageCache.GetAsImageSourceAsync("https://www.example.com/image.png");
@@ -106,4 +116,4 @@ Contributions Are Appreciated and Welcome
106116

107117
Bugs 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.

0 commit comments

Comments
 (0)