Randomly change background image

I found this site.

Get the url like
https://picsum.photos/1600/1200

and place this to UX pane, brand tab, either background or launch image.

This will randomly change the image.

Just for a fun.

10 16 1,569
16 REPLIES 16

It looks like sync of app wont change the image. But when i close the app on browser and restart the app with sync, the different image was rendered.FYG.

I put images I want to alternate in a folder on my server and number them. Then I use RANDBETWEEN() in a concatenate expression to put the URL together:

Concatenate(“first part of url”,RANDBETWEEN(1,10),".jpg")

Works quite nicely.

Nice Kirk.

Enjoy customization of your apps!

Hi @Kirk_Masden , a year late to this but THANK YOU! Brilliant idea. Much appreciated.

Hi @Kirk_Masden , when you had 2 min to spare, could I trouble you for your help on your alternating images tip? I’ve spent a few hours trying your formula but can’t seem to make it work? I attached some screenshots below so hopefully the error is obvious on your end. (FYI - I only have 4 images so changed your formula from (1,10) to (1,4) Thanks in advance

EDIT: As I was reviewing my post, I caught one error, my files are named 1.jpeg, 2.jpeg, etc whereas in the formula it was “.jpg” so I updated that but still doesn’t work.

Hi @zonezsf !

I think the problem is that the name that you give a file on Google Drive is different from the address. I work I a university that gives me space on a server. There, if I name a file “1.jpeg” then that is the name that will be in the URL. If you right click on an image in Google Drive an get the URL, I think you will see that the URL is different from the name you have given it.

I’m not sure if there’s a good workaround for Google Drive. I hope someone else can help. Since AppSheet is now part of Google, I hope there’s a way to do this on Google Drive. That would make things easier for most people.

Hi @Kirk_Masden !

Thanks for your reply. I appreciate your time and help. I just double checked the file name and tried using a single image and it worked fine. (see below screenshots) So assuming I have the right file names/addresses, is there anything else you think might be off? Or is it the file name in the actual CONCATENATE formula that might be off? Thanks again!

You might falling trap to the relative paths. The relative paths are relative from Spreadsheet and NOT the “app data” folder.

If that fails as a test, change image path of the column to be CopyOfHomeImages and upload and image and verify that it upload to correct folder and the path in spreadsheet is the same.

I’m afraid I don’t have a good idea about how to handle this issue on Google Drive. A more “old fashioned” server where you can determine the name to be used in the URL yourself would work but I’m not sure if that can be done in Google Drive. Good luck!

Is it supposed to work by having the code there? I can’t get it. Thx

I haven’t tried it with the app logo, thought I think it should work there too. I’ve actually used CONCATENATE to do this in SHOW and IMAGE columns.

Ok. Looks like it’s not possible to add this in the brand fields. Thx

Thanks for responding. I just check on my own app and I see that the place where the URL goes doesn’t take app formulas. So I guess you’re right. We can’t use app formulas here.

Steve
Platinum 4
Platinum 4

Thanks @Steve @Kirk_Masden @elco for the tips and feedback! I’ll give it a shot. (Fingers crossed)

Appreciate all your help

So good news is the new path works fine but then the obvious realization hit “how can I use the CONCATENATE formula to switch between images?” since part of Kirk’s trick was just using simple numerical file names, right?

Oh well, I guess I might have to look into a server if I want to move forward on having randomly changing images. On a different note, it felt like the images loaded slower using the direct links vs the app data folder. Not sure why but when I would hit refresh, it took a few seconds longer to load.

Thanks again all for your time.

Top Labels in this Space