FFImageLoading Plugin - fast and memory friendly image loader (iOS/Android/Forms/Windows)

FFImageLoading

Library to load images quickly & easily on Xamarin.iOS, Xamarin.Android, Xamarin.Forms and Windows (WinRT, UWP).

image

Features

  • Xamarin.iOS, Xamarin.Android, Xamarin.Forms and Windows (WinRT, UWP) support
  • Configurable disk and memory caching
  • Multiple image views using the same image source (url, path, resource) will use only one bitmap which is cached in memory (less memory usage)
  • Deduplication of similar download/load requests. (If 100 similar requests arrive at same time then one real loading will be performed while 99 others will wait).
  • Error and loading placeholders support
  • Images can be automatically downsampled to specified size (less memory usage)
  • Fluent API which is inspired by Picasso naming
  • WebP support
  • Image loading Fade-In animations support
  • Can retry image downloads (RetryCount, RetryDelay)
  • On Android transparency is disabled by default (configurable). Saves 50% of memory
  • Transformations support (BlurredTransformation, CircleTransformation, RoundedTransformation, CornersTransformation, CropTransformation, ColorSpaceTransformation, GrayscaleTransformation, SepiaTransformation, FlipTransformation, RotateTransformation)
  • Supports custom transformations (native platform ITransformation implementations)

If you have any questions regarding this lib, just ask here.

«1

Posts

  • JacobPoulsen_JacobPoulsen_ DKMember ✭✭✭
    edited January 2016

    Hi @DanielLuberda

    Ill give your plugin a shot right away.

    I have one question though, lets say i have a REST webservice that would require a different HttpClient at each call (or at least i need to update the content im sending with the httpclient to be able to fetch the right images) is that possible since i can only set the HttpClient in the Initialize method?

    Heres an example of what im trying to do inside my PCL code somewhere:

    var httpContent = new StringContent(json, Encoding.UTF8, "application/json");

    var httpResponse = await httpClient.PostAsync("url-to-webservice/something?Action=mymethod", httpContent);

    the json object is where i set my parameters, so lets say i want to get a user profile image, i would add the userid into the json object and send that with the request.

    Do you see any solution to this? Can i set the HttpClient at runtime? Change its content?
    Any help appreciated!

  • DanielLDanielL PLInsider ✭✭✭✭
    edited January 2016

    @Jacob_b

    ImageService.Initialize shouldn't be used multiple times.

    I didn't test it, but my idea is:

    • create a custom http handler which rewrites urls if it detects additional data in string (specified by you).
    • set FFImageLoading to use it with ImageService.Initialize
    • pass additional information in url (handler will parse and handle those info and remove it from url string after that and then call your logic with extracted data)
  • RaphaelChiorlinRanieriRaphaelChiorlinRanieri BRMember ✭✭✭

    @DanielL I'm using your plugin and was wondering on how to increase performance.

    I found in documentation this

    The Sroll High Performances in Advanced Usage.

    Since now we do not have the method ScrollStateChanged in newer versions of Xamarin Forms.

    How would you do this?

  • DanielLDanielL PLInsider ✭✭✭✭

    @RaphaelChiorlinRanieri
    It depends of your logic. Eg. There are ItemAppearing and ItemDisappearing events in ListView - you can use them to detect "fast scroll" operations.

  • arkark USMember
    edited September 2016

    Hi Daniel,
    I have xamarin.forms project.I had problem loading images in the big listview for android(ios working fine). FFImageLoading seems to solve the problem. only thing is, on first appearance i still don't see all images but if i navigate back and visit again, the images load. I don't see loadingplaceholder image during first load as well.

  • DanielLDanielL PLInsider ✭✭✭✭
    edited September 2016

    @ark Can you show me your code, it's hard to help without any details. Also please try the newest prerelease packages.

  • DanielLDanielL PLInsider ✭✭✭✭
    edited November 2016

    SVG support now working (Preview)

    SVG files are now working and support every FFImageLoading's feature. For now, only Android / iOS is added, but adding Windows is just a matter of configuration. It uses SkiaSharp for rendering.

    Xamarin.Forms

    It's very easy, just add Xamarin.FFImageLoading.Svg.Forms nuget and use a custom SvgImageSource which enables SVG support. Please notice, that it has optional parameters for controlling renderered SVG size (automatic by default) IMPORTANT: Your projects must also reference System.Xml.Linq.

    From code:

    source = SvgImageSource.FromFile("image.svg")
    source = SvgImageSource.FromUri("http://example.com/image.svg")
    // etc...
    

    Or use a provided converter (eg. when using XAML):

    Source="{Binding image.svg, Converter={StaticResource SvgImageSourceConverter}}"

    Native

    Add Xamarin.FFImageLoading.Svg nuget. When loading images you have to configure custom data resolver which enables SVG support:

    ImageService.Instance
                .LoadFile("image.svg")
                .LoadingPlaceholder("placeholder.svg")
                .WithCustomDataResolver(new SvgDataResolver(200, 0, true))
                .WithCustomLoadingPlaceholderDataResolver(new SvgDataResolver(200, 0, true))
                .Into(imageView);
    
  • JensDemeyJensDemey USMember ✭✭

    @DanielL
    Awesome work with the SVG images. I'll be sure to check it out soon. I do have a question unrelated to SVG however.

    Is there a way to tell FFimageloading that an image is "not important" enough put into the cache (or to give it a high priority to get evicted from the cache)?

    Just to clarify:
    I have a few pages with static images that are always a part of the page (therefore these should always be cached).
    On one page there is a dynamic image, it can be updated to show potentionally hundreds of different images. The problem here is that every different image will fill up the cache and eventually push out the other static images (even though each source of the dynamic image will only be shown once).

    I thought that I could prevent the dynamic image from caching it's source in memory by doing the following
    var imgUnimportant = new CachedImage(){ Source = "random.png", CacheType = Cache.CacheType.Disk };
    But it seems like it still gets cached.

    I have got it working by doing the following:
    imgUnimportant.FinishCommand = new Command(() => ImageService.Instance.InvalidateCacheEntryAsync("random.png", Cache.CacheType.All, true));

    But perhaps there is a better solution?

  • DanielLDanielL PLInsider ✭✭✭✭
    edited November 2016

    @JensDemey It's because wrong order of setting properties:

    var imgUnimportant = new CachedImage(){ CacheType = Cache.CacheType.Disk, Source = "random.png" };

    Setting source runs image loading task.

  • JensDemeyJensDemey USMember ✭✭

    @DanielL
    Thanks for your quick response. I have just run it but the image is still getting cached in memory. (I have also checked the source code and I can't find anything that checks the CacheType enum aside from the functions that invalidate the cache.)

  • DanielLDanielL PLInsider ✭✭✭✭
  • FlorianMICHALONFlorianMICHALON FRMember ✭✭

    @DanielL

    I want to use FFimageLoading Svg but when i want generate project i have an error :

    Gravité Code Description Projet Fichier Ligne État de la suppression Erreur Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'FFImageLoading.Svg.Platform, Version=1.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile? Nom de fichier : 'FFImageLoading.Svg.Platform.dll' à Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters) à Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(ICollection1 assemblies, AssemblyDefinition assembly, Boolean topLevel)
    à Xamarin.Android.Tasks.ResolveAssemblies.Execute() Mu.Droid
    `
    Do u have an idea for resolve that ?

    Thanks in advance.

  • DanielLDanielL PLInsider ✭✭✭✭
    edited November 2016

    @FlorianMICHALON It's a nuspec issue, I'll fix that soon. FFImageLoading.Svg is not needed in Forms PCL project, only FFImageLoading.Svg.Forms

  • FlorianMICHALONFlorianMICHALON FRMember ✭✭

    Ok thanks for the answer but this is installed when i install FFImageLoading.Svg.Forms.

  • DanielLDanielL PLInsider ✭✭✭✭

    Yes, it's a wrong defined nuspec for FFImageLoading.Svg.Forms. I'll fix that today.

  • batmacibatmaci DEMember ✭✭✭✭

    @DanielL said:
    Yes, it's a wrong defined nuspec for FFImageLoading.Svg.Forms. I'll fix that today.

    Do we have to keep it for ios and android projects? but remove manually from forms project?

  • batmacibatmaci DEMember ✭✭✭✭
    edited November 2016

    @DanielL I just checked and i dont have this reference on my forms project but i am getting this error. It looks like that it is looking for another dll under droid project.

    Severity    Code    Description Project File    Line    Suppression State
    Error       Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'FFImageLoading.Svg.Platform, Version=1.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
    File name: 'FFImageLoading.Svg.Platform.dll'
       at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
       at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(ICollection`1 assemblies, AssemblyDefinition assembly, Boolean topLevel)
       at Xamarin.Android.Tasks.ResolveAssemblies.Execute()         
    

    it build successful after removing FFImageLoading.Svg.Forms reference from Droid project. I dont understand why it returns error but this is referenced also in ios, uwp projects and they dont return any build error but runtime it returns error

  • DanielLDanielL PLInsider ✭✭✭✭

    @batmaci It's fixed. Try the newest prerelease.

  • FlorianMICHALONFlorianMICHALON FRMember ✭✭

    It's works for me ! Thanks !

  • batmacibatmaci DEMember ✭✭✭✭

    @DanielL It works for me also. thanks. I want to ask how is the performance if use in list with many files. This i havent tried yet. Are you able to give some information please?

  • DanielLDanielL PLInsider ✭✭✭✭

    The performance when using with many files will be the same as using FFImageLoading with png/jpg images. All images are cached, and if you use the same image in multiple views, it will be reused, so only one SVG decoding will be done only once per image.

  • SandbhaSandbha INMember
    edited January 5
    Hi DanielL
    I am developing a windows phone8.1 application using c# & xaml ,in this app I want to bind images to my listview and itemsource of listview is List


    Class ImageToken{
    string Title{ get;set;}
    String ItemToken{ get;set;}
    }

    To display image in listview item we need to get byte array using ItemToken property from above given class. In order to get this byte array i need to call below method for each listview item

    Task DownloadImageFrom(string imgTokenname)
    {
    return await DownloadImageBytes(name)
    }

    Can you please provide a solution to cache and load images using FFImageLoading or ImageService.Instance.LoadStream() to get the above thing work...it would be great if you provide some sample Win phone 8.1 for the above thing to work without blocking UI while images are downloading.
  • DanielLDanielL PLInsider ✭✭✭✭
    edited January 8

    Hi @Sandbha,

    Is it WinRT application or Xamarin.Forms? For WinRT / Native you can just do this:

    ImageService.Instance
        .LoadStream(async () => await DownloadImageFrom())
        .Into(yourNativeImageViewControl);
    

    That's all. You can also specify cache key (as stream caching is disabled by default):

    ImageService.Instance
        .LoadStream(async () => await DownloadImageFrom())
        .CacheKey("your custom cache key")
        .Into(yourNativeImageViewControl);
    

    For Xamarin.Forms you can use CachedImage, just the same as Image for streams, just use StreamImageSource.

    Example with custom cache keys here:

  • AndreBicoAndreBico USMember ✭✭
    edited January 30

    Hi DanielL

    If a taskParams has a transformation attached lets say a CropTransformation, will the cached image be the cropped version or the original image?

    Im assuming its the original image.

  • DanielLDanielL PLInsider ✭✭✭✭

    Hi @AndreBico

    If transformation attached, memory cache entry is a transformed image, but the disk cache entry is always an original image.

  • batmacibatmaci DEMember ✭✭✭✭
    edited February 1

    @DanielL how to refresh images once it is cached. for example, I am setting noImage.png if image cant be downloaded some reason and it is cached. But later when I have connection and image available, it wont get refreshed, still shows not found image. How can I fix this problem?

    var cachedImage = new CachedImage()
    {
    HorizontalOptions = LayoutOptions.Center,
    VerticalOptions = LayoutOptions.Center,
    WidthRequest = Device.Idiom == TargetIdiom.Phone ? 300 : 500,
    HeightRequest = Device.Idiom == TargetIdiom.Phone ? 300 : 500,
    CacheDuration = TimeSpan.FromDays(30),
    DownsampleToViewSize = true,
    RetryCount = 0,
    RetryDelay = 250,
    TransparencyEnabled = false,
    LoadingPlaceholder = "refresh.png",
    ErrorPlaceholder = "noImage.png",
    Source = ImageUrl

  • DanielLDanielL PLInsider ✭✭✭✭

    @batmaci You could:

    • Use cachedImage.ReloadImage() method
    • Set Source property to null then again to ImageUrl
  • batmacibatmaci DEMember ✭✭✭✭
    edited February 1

    @DanielL said:
    @batmaci You could:

    • Use cachedImage.ReloadImage() method
    • Set Source property to null then again to ImageUrl

    how about for the images failed to download ? are they automatically handled and later will be downloaded when I am online again. I mean i can only set null or reloadimage if there is no image.

  • DanielLDanielL PLInsider ✭✭✭✭
    edited February 1

    @batmaci Not automatically, you have to force an update (eg. ReloadImage method) after you are online again and missing images will be downloaded once again.

  • geor_michgeor_mich GRMember ✭✭

    @DanielL good job !!! This is a very nice plugin . Thanks !!

    I have one problem.

    Only first time control loadin image ... in all others images i get the following exception

    2017-02-07 11:28:17.171 MyProject.iOS[2053:160829] Image loading failed: https://mysiteurl/myimage.png;0x400

    System.ArgumentNullException: Value cannot be null.

    Parameter name: dictionary

    at Foundation.DictionaryContainer..ctor (Foundation.NSDictionary dictionary) [0x0000c] in /Users/builder/data/lanes/3818/ad1cd42d/source/xamarin-macios/src/Foundation/DictionaryContainer.cs:56

    at CoreGraphics.CGImageProperties..ctor (Foundation.NSDictionary dictionary) [0x00000] in /Users/builder/data/lanes/3818/ad1cd42d/source/xamarin-macios/src/CoreGraphics/CGImageProperties.cs:60

    at ImageIO.CGImageSource.GetProperties (System.Int32 index, ImageIO.CGImageOptions options) [0x00000] in /Users/builder/data/lanes/3818/ad1cd42d/source/xamarin-macios/src/ImageIO/CGImageSource.cs:294

    at FFImageLoading.Extensions.NSDataExtensions.ToImage (Foundation.NSData data, CoreGraphics.CGSize destSize, System.nfloat destScale, FFImageLoading.Extensions.NSDataExtensions+RCTResizeMode resizeMode, FFImageLoading.Work.ImageInformation imageinformation) [0x00012] in :0

    at FFImageLoading.Work.PlatformImageLoaderTask`1+d__3[TImageView].MoveNext () [0x000e9] in :0

    --- End of stack trace from previous location where exception was thrown ---

    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/3818/ad1cd42d/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143

    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /Users/builder/data/lanes/3818/ad1cd42d/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187

    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/3818/ad1cd42d/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156

    at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/3818/ad1cd42d/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128

    at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in /Users/builder/data/lanes/3818/ad1cd42d/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:535

    at FFImageLoading.Work.ImageLoaderTask`2+d__109[TImageContainer,TImageView].MoveNext () [0x00489] in :0

    My xaml is really simple

    cs
    imageloading.Source = selectedProduct.Url;

  • geor_michgeor_mich GRMember ✭✭

    @DanielL good job !!! This is a very nice plugin . Thanks !!

    I have one problem.

    Only first time control loadin image ... in all others images i get the following exception

    2017-02-07 11:28:17.171 MyProject.iOS[2053:160829] Image loading failed: https://mysiteurl/myimage.png;0x400

    System.ArgumentNullException: Value cannot be null.

    Parameter name: dictionary

    at Foundation.DictionaryContainer..ctor (Foundation.NSDictionary dictionary) [0x0000c] in /Users/builder/data/lanes/3818/ad1cd42d/source/xamarin-macios/src/Foundation/DictionaryContainer.cs:56

    at CoreGraphics.CGImageProperties..ctor (Foundation.NSDictionary dictionary) [0x00000] in /Users/builder/data/lanes/3818/ad1cd42d/source/xamarin-macios/src/CoreGraphics/CGImageProperties.cs:60

    at ImageIO.CGImageSource.GetProperties (System.Int32 index, ImageIO.CGImageOptions options) [0x00000] in /Users/builder/data/lanes/3818/ad1cd42d/source/xamarin-macios/src/ImageIO/CGImageSource.cs:294

    at FFImageLoading.Extensions.NSDataExtensions.ToImage (Foundation.NSData data, CoreGraphics.CGSize destSize, System.nfloat destScale, FFImageLoading.Extensions.NSDataExtensions+RCTResizeMode resizeMode, FFImageLoading.Work.ImageInformation imageinformation) [0x00012] in :0

    at FFImageLoading.Work.PlatformImageLoaderTask`1+d__3[TImageView].MoveNext () [0x000e9] in :0

    --- End of stack trace from previous location where exception was thrown ---

    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/3818/ad1cd42d/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143

    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /Users/builder/data/lanes/3818/ad1cd42d/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187

    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/3818/ad1cd42d/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156

    at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/3818/ad1cd42d/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128

    at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in /Users/builder/data/lanes/3818/ad1cd42d/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:535

    at FFImageLoading.Work.ImageLoaderTask`2+d__109[TImageContainer,TImageView].MoveNext () [0x00489] in :0

    My xaml is really simple

  • geor_michgeor_mich GRMember ✭✭

    @DanielL good job !!! This is a very nice plugin . Thanks !!

    I have one problem.

    Only first time control loadin image ... in all others images i get the following exception

    2017-02-07 11:28:17.171 MyProject.iOS[2053:160829] Image loading failed: https://mysiteurl/myimage.png;0x400

    System.ArgumentNullException: Value cannot be null.

    Parameter name: dictionary

    at Foundation.DictionaryContainer..ctor (Foundation.NSDictionary dictionary) [0x0000c] in /Users/builder/data/lanes/3818/ad1cd42d/source/xamarin-macios/src/Foundation/DictionaryContainer.cs:56

    at CoreGraphics.CGImageProperties..ctor (Foundation.NSDictionary dictionary) [0x00000] in /Users/builder/data/lanes/3818/ad1cd42d/source/xamarin-macios/src/CoreGraphics/CGImageProperties.cs:60

    at ImageIO.CGImageSource.GetProperties (System.Int32 index, ImageIO.CGImageOptions options) [0x00000] in /Users/builder/data/lanes/3818/ad1cd42d/source/xamarin-macios/src/ImageIO/CGImageSource.cs:294

    at FFImageLoading.Extensions.NSDataExtensions.ToImage (Foundation.NSData data, CoreGraphics.CGSize destSize, System.nfloat destScale, FFImageLoading.Extensions.NSDataExtensions+RCTResizeMode resizeMode, FFImageLoading.Work.ImageInformation imageinformation) [0x00012] in :0

    at FFImageLoading.Work.PlatformImageLoaderTask`1+d__3[TImageView].MoveNext () [0x000e9] in :0

    --- End of stack trace from previous location where exception was thrown ---

    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/3818/ad1cd42d/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143

    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /Users/builder/data/lanes/3818/ad1cd42d/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187

    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/3818/ad1cd42d/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156

    at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/3818/ad1cd42d/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128

    at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in /Users/builder/data/lanes/3818/ad1cd42d/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:535

    at FFImageLoading.Work.ImageLoaderTask`2+d__109[TImageContainer,TImageView].MoveNext () [0x00489] in :0

    My xaml is really simple

  • DanielLDanielL PLInsider ✭✭✭✭

    Hi @geor_mich

    Did you solve it? I don't know what can cause this, can you share some code?

  • geor_michgeor_mich GRMember ✭✭
    edited February 16

    @DanielL i can't find anything . My code is really simple.

    xaml

    xmlns:ffimageloading="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms"
    ....
    <ffimageloading:CachedImage HeightRequest="200" VerticalOptions="Start" x:Name="imageloading"/>
    

    c#

    public ProductsOverviewPage (Products.Product selectedProduct)
            {
                InitializeComponent ();
                    if (selectedProduct.Url.Contains (".png")) 
                    {
                        imageloading.Source = selectedProduct.Url;
                    }
            }
    
    async void RelatedProductBtn_Click (object sender, System.EventArgs e)
            {
                await Navigation.PushAsync (new ProductsOverviewPage (related_product), true); //navigate again in same page with another product
    
            }
    

    That's all !!! I dont know why i get this exception.

  • akshay2000akshay2000 INMember
    edited February 21

    Is there a way to access image cache? I read through the wiki but didn't find relevant documentation. Basically, I have this app that shows images from URLs. A user may choose to save that image to their device. I'd rather not download the whole image since I know this library caches images. How do I access the cached image? I'd also like to handle cache vs download transparently. Will it download the image if it's not already downloaded?

    Just in case, here is my app's repository: https://github.com/akshay2000/MonocleGiraffe
    The API is a bit confusing for me. So, if I'm doing something wrong, please let me know.

  • DanielLDanielL PLInsider ✭✭✭✭

    @AkshayZade,

    Yes, just subscribe to Success event / command. It gives you file information as a parameter (including full file path).

  • DanielLDanielL PLInsider ✭✭✭✭

    @geor_mich maybe images files are corrupted?

  • BigBugBigBug USMember

    how can i use it with mvvmcross ?

  • MrRubinMrRubin USMember ✭✭

    @DanielL, thanks for adding svg support. Is it possible to put the svg files in the shared project rather than the 'Resources' folder of the platform specific projects? I have my svgs in [SharedProject]/AllImages/Svg folder and getting System.IO.FileNotFoundException when trying to load them.

  • akshay2000akshay2000 INMember

    @DanielL said:
    @AkshayZade,

    Yes, just subscribe to Success event / command. It gives you file information as a parameter (including full file path).

    I tried this. But Success, FileWriteFinished and Progress are bit of a hit and miss. I have documented the behavior over at GitHub.

«1
Sign In or Register to comment.