Let users change background image on post


When users create a post on my app with title, description etc, i want to provide like 4-5 gradient images they can choose between to be the background of the post, how would i go about doing this? I know i would have to upload them to my database, but how after that?

Once you’ve uploaded the to your file storage, and stored a reference to them in your database, just provide some way for the user to select one (obviously how you do that depends on the UX and design you want for your users).

Once they’ve selected one, just save that to the relevant field in the database.

To elaborate on my current setup:
I have images stored in the option sets, and a data field in my “post” data.
I also have a repeating group where all the gradients are - the repeating group is presented during the “create post” part.

My current issue is how do i make EACH image selectable AND make it possible for them to be added to the post-database

Well, again obviously, that depends on what you’re trying to do and the design/UX you’re trying to achieve…

But if was me I’d use a RG to display the images, a custom state to hold the selected one.

Obviously hard for you since you arent familiar with my current setup :smiley:, but when i make a post it “creates a new thing” in my db. How would i get the result of the state into the “create a new things”

i figured it out, thank you! I used custom state “image” instead of a number - made it a lot easier

1 Like

Just refer to it in the field…

i.e. if you have a custom state on the page called ‘Selected Image’ and a field in your database called ‘Background Image’, just set the Background Image field to Page’s Selected Image.