How do you load images asynchronously?

Dear Developer,

I'm trying to load images from a website into my app. I'm trying to do this in the background but I'm having difficulties accomplishing it with your extension. I would really appreciate your help! I've read all the documentation that comes with the extensions and some discussions here as well. Please check the screenshot and let me know what do I need to do to fit the procedure into the socket.

Thanks

Well, it does not really make much sense what you are doing... it looks like there is some confusion about background and foreground?

When your app is in rhe background, there is no user interface available!

Also there is no such event inageload... you can't just invent events, which do not exist..
Your inageload procedure woulld be correct if you add an argunent x... see also the first post of this thread... but as mentioned earlier, inage components do not exist in the background...

What about having a few pictures stored as assets in your app and load them from there? No background process required...

Taifun

1 Like

Thank you for always helping us out Taifun!
So, I made an ebook reading app where people can read timeless classic literature. In a page, I used image blocks with URLs. The problem is that image loading is taking too much time, so I'm getting an error message that is not responding. I've tried many solutions but nothing worked so far. Couldn't find any related YouTube videos. So, I tried to solve the problem with ChatGPT. And chatgpt suggested whatever you saw on the screenshot!
In summary, ChatGPT told me a few strategies like compressing images (which I already did), caching, periodical loading to minimize the load time, etc. Also suggested me to put the loading process in the background tasks.

Anyway, I would really appreciate if you can suggest me the things I need to do to stop getting the app not responding message.

Thank you again!

Hello, the words "background tasks" has two meanings.

  • One of them is to make your app run in background (even if the app gets closed). The extension is intended for this purpose.
  • The other meaning is to run a task parallel within the app (parallel tasks or async tasks). This is the meaning that you are referring to.
1 Like

Hey there,

This reply doesn't help solve the problem! But anyway, by background task, I am referring to " * The other meaning is to run a task parallel within the app (parallel tasks or async tasks). This is the meaning that you are referring to."

Hope that makes sense!

Every time the app tries to load images from URLs, I get an error message saying the app not responding!

How can I stop that message? Also, I have seen data fetching and storing blocks. Is it possible to use this extension to cache images so that they don't need to load every time they open the app?

Thank you for creating free extensions like this! I really appreciate your time and effort. You are making the internet an amazing place! :heart:

Hello @St_Badhon,
It is not possible to do the things you stated, since you are referring to Parallel tasks (aka Async tasks) which is beyond the scope of this topic.

This extension's purpose is to only make your app run in background/foreground (i.e. when your app is closed). You should ask your problem in a new topic. Since it's a different aspect.

1 Like

Do you know any extensions that might help me make it possible?

How would this sample app differ from what you want?

It uses Web viewers to directly show online images as needed.

2 Likes

maybe this extension helps:

1 Like

You might try these extensions.

What if you first download the images (when you first start the app) into the ASD or PrivateDir and from there pass them to the Image component?

1 Like

Hey Anke,

That is a great idea and I also thought about it. Just not sure about the mechanisms or how to do it. Would you please share a bit more details?

Thank you!

Try this app and see if it is what you are looking for:

Blocks

1 Like

I tried this extension! But the problem is it's loading images too slowly! I have compressed and resized images for better loading but it's not helping. Is there a way to make it really fast with this extension?

Try other solutions above said.

1 Like