Query efficiency fetching images from URLs

Hi all,

I am a new coach in a CoderDojo where we work with App Inventor. This is my first post and I need help.

I am using DynamicComponents of the Image type to populate a VerticalScrollArrangement based on a list of URLs read from a Google SHEET column (via the SpreadSheet Component).

It works but is very slow to acquire only 8 pictures (about 10 seconds).

Any clue how to make this more efficient/quicker.

I'll try to add some screenshots to this post

Thanks a lot,

Yves (from Belgium)

Reduce Image Size ?

Off-topic: I was assigned this topic. I guess because @YvesB is also running a CoderDojo. Hi @YvesB, nice to meet you. I run a Dojo in Tilburg, The Netherlands.

Where are you from?

If you are using App Inventor and have some micro:bits or other microcontrollers you could also start using MicroBlocks. MicroBlocks makes it really easy to program microcontrollers in a live environment.

The developer of MicroBlocks made an MicroBlocks extension for App Inventor.

Using that extension it is really easy to program an app that can control a microcontroller. I already made a lot of them. One of them you see below.

Since the url is the source for the image you the available image at the url determines the size of the image you download. The imaged is 'right sized' by App Inventor for your app's display size. This takes time. All considered your download experience you think is very slow to acquire only 8 pictures (about 10 seconds) is actually probably pretty good.

The download is probably faster or slower if you are using wifi versus data through your cell phone.

Have you considered preloading the image files in the Media folder of the app, and using a ListView set to display images?

Hi,
Thanks for the tip, but the images are all 225x225 pixels less than 10 KB each.
I doubt this explains the low speed.
Yves

Hi ABG,

I actually did but I want the galerie that I display (the avatars of my ninjas) to be dynamic, ie not casted in the code. If I add (or remove) a new ninja + the URL of his avatar picture in my google sheet, then I want it the galery to refresh and adapt dynamically. This would not be possible with preloaded media.

I also tried the Listview component to display both an image and a text, but I can't define the image by an URL : it has to be preloaded (or at least I didn't succeed in another way).

Is there maybe a way in App Inventor to automate the adding/removal of images in the media library ? I guess no, because this happens all before compilation/packaging.

How would you recommend to achieve my purpose, which is displaying a dynamic list of images in a scroll layout ?

Thanks,

Yves

PS : by the way, thanks to all who replied to me so quickly. I did'nt expect that much return from my first question :blush:

Hi SteveJG,

Thanks for the tip, but the pictures I point to are all 225x225 pixels and less than 10 kB each. Can't be that... Plus I am on a 'decent' wifi.

Good day to you,

Yves

Hi Peter,

Thanks for your message and the interesting material for Microblocks.

The Dojo I am in is located in Fernelmont, close to Namur in Belgium. It is a very small group, but we have fun with the kids. This year, we are starting with App Inventor, which is a great motivation for the 'older' ones (a bit fed up with Scratch).
We are trying to develop an app for our Dojo purposes in which that dynamic photo gallery takes place. If you have some tips on how to achieve this best, I take :blush:

One of the coach does some 'things' with micro:bits. I'll pass your information to him.

bus as I said, for the moment, the kids are all on Android development.

Happy sunday :blush:

Yves

1 Like

Maybe next year you could visit FOSDEM. Last couple of years my son and I organised workshops for children with the help of CoderDojo and developers of MicroBlocks, Snap, Turtlestitch, App Inventor and others.

Try the Taifun file pre-load technique.

To avoid wasteful reloads , keep your file lists in TinyDB for persistence.

Use row count as a high water mark to check for new additions.

This, took @ 6 seconds to fetch and display 10 images listed on a google sheet:

As suggested, if you download and save only the new images, then use a file listing from the device, this should eventually speed things up.