Pulling in images for streaks

With Robert’s help I’ve built a streak counter (I call it “chore chains”) in my app. I had a designer make a series of images of a silver chain getting more and more links turning gold. I want the proper image to become visible based on the length of the current streak. This is all easy enough if I insert all the image components and source them using a URL and then setting the visibility set for each one to match the current streak. However, I’m trying to speed up load times and the dependability of the images so I’d like to load them into glide instead of using a URL. This tab uses the USER sheet, and I can’t figure out where exactly to load the images so I can reference them. I tried using my Lists tab and creating a relation but it’s not showing as an option for the image components. Any help?

Where are the images stored now?

If you create an image column, you can upload an image directly into that column, or you can use an image picker to upload an image as well. The thing is, the image will be uploaded to Glide storage, but I’m not sure how much it would speed things up. You still end up with a url of the image to Glide’s storage. What happens in an app is that each user’s device needs to download and cache that image from the url, so it may still have some initial lag. It may or may not load faster depending on the quality of the storage server you are currently using for your images. I’d still recommend storing in glide though.

What I would maybe do is create a new sheet for image resources. Then in your user sheet use the streak count value to create a single relation to the image resource sheet. Then create a lookup column to get the image url. Your image component can then point bro that lookup column to display the corresponding image.

2 Likes

Yeah, what the relation shows is a little weird. I think it’s either supposed to be the first column in the row, or the column before or after the the column you link to. Not really sure. I’ve seen different results, and maybe it varies if you’ve shuffled columns around. Either way, as you’ve noticed, it doesn’t really matter. It’s just telling you that it found a matching row.

To have your streak reset, I’m not sure how you track a streak right now. I’m assuming date comes into play? You could probably do something like an IF column that checks if the last date is more than 1 day prior to today’s date, then return 0, else return the current chain value. Then use that IF column for your relation.

As for image compression, I believe Glide does optimize images automatically…at least in certain circumstances…depending on the browser and if the image is being shown in an image component, or list, or some other view. There’s some basic info below.

1 Like