Display ~50 images in a list

I’ve got ~50 images loaded into files. But when I loop over them and add each into a UITableRow and then into a UITable and finally present the table, (like this:)

  const table = new UITable();
  for (const mediaItem of mediaInfo.mediaItems) {
    const tableRow = new UITableRow();
    const image = await new GoogleImage(mediaItem).getGoogleImage();

it displays at first, but then chugs to a halt and crashes when I try to scroll it. Is this too much for Scriptable? Is there a more efficient way to display that many images in a vertical list?

cheers and thanks!

I suspect it is a memory thing as you suggest.

Why not try it with 2 or 3 images and see if it handles that? If that is okay, increment up to find what you can display.

Perhaps also experiment with reducing the image file sizes. You may be able to get roughly the same quality with greater compression or a reduction in the number of pixels.

1 Like

As a last resort, if nothing worked to your liking what @sylumer suggested, you can use a WebView to display the images. It runs in a separate process and has therefore more memory available for you.
You can generate the HTML file with relative links to the images, save the HTML file in the same folder as the images (or somewhere else, but make sure that the images are linked correctly) and use WebView.loadFile to load it. This way the loading of the images is done by the WebView process and should not crash.


this is a really good idea. And I’m very familiar with CSS and HTML so I can style it much better too. thanks!

Comfortable sharing the use case? I’m curious

Yeah. I’ve created a widget that picks a random photo from “on this day” out of my google photos account. When I click on the widget I’d like the app to show me all the photos from “on this day”. Right now clicking on the widget just loads that single photo

1 Like

For now I decided it wasn’t worth the time, though. What I really wanted was the widget anyway :slight_smile:

Clever! I might give this a go as well :slight_smile: