Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added the option to display downloaded images using the prefix 'file:' #304

Closed
wants to merge 1 commit into from
Closed

Added the option to display downloaded images using the prefix 'file:' #304

wants to merge 1 commit into from

Conversation

edurossi
Copy link

Hello, I added to the loading of images the option to load from downloaded files as I need on my project. I think the change is very little and maybe someone else would need it too.
I read that I should open an issue first and talk about it, but as the change is very small and I already did it for my project, I just want to share it with you and you can decide if you want it or not.
Thank you for this project, I really like it !

@erickok
Copy link
Collaborator

erickok commented Jan 15, 2021

Let's discuss: #497

@tneotia tneotia mentioned this pull request Jan 17, 2021
@tneotia
Copy link
Collaborator

tneotia commented Feb 4, 2021

Hi there, thanks for this PR! With #505, we have finally added this capability into the library with a custom image rendering API (much better than the current customRender). You can see the discussion at #497 to see how it works. If you have any suggestions, please let @erickok know there. Again thanks for contributing! :)

@erickok
Copy link
Collaborator

erickok commented Feb 8, 2021

Duplicate of #478 and see there for more discussion, but basically you can now do this:

  // Some path to where your images are
  final localRoot = "/app/accessible/path/to/images";

  // Handle all paths that start with a / and treat as local
    (attr, _) => attr["src"] != null && attr["src"].startsWith("/wiki"):
        (context, attr, element) {
      final file = File(localRoot + attr["src"]);
      return Image.file(file);
    },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants