Forum Academy Marketplace Showcase Pricing Features

How to have a default value ind data base for images?

I want my users to upload a pic during registration. If however they do not upload a pic a default pic should be displayed. In the database I have uploaded a default image in the image section.

However, I still can’t see default pic in my database. What exactly is the the problem ?

Hi @akul3007 :slight_smile: The default image will be applied to new Users created (after you set the default pic). If you create a new User account, it should show up in the app data.

To change this for Users who don’t have a pic right now, you can create a workflow which makes Changes to a List of Users (Do a Search for Users, constraint = image is empty), and then change that image field value to be the value of a Picture Uploader containing the default image.

1 Like

thanks. It worked

1 Like

under what element do I out that workflow?

Hi @emakengu2015 :slight_smile: One way would be to add an API endpoint similar to this:

(the value of the field would be the URL of the default profile picture image)

Once that endpoint is pushed to live, a new database view of Users without profile pictures in your live environment can be created in order to display only the Users without a profile picture through the App Data tab:

Once the new database view has been created, click on the “Bulk” option (shown below) and run the just-created API workflow on that table of Users, making sure "Users (without profile picture) is still selected. (I would attach a screenshot of this but this demo app is on the Hobby plan so I don’t have the option to run this currently).

Alternatively, for apps that can’t run API workflows, you could create a temporary page called ‘modify’ (for example) and set up a quick workflow such as:
“When page is loaded” action --> Make Changes to a List of Users (constraint: profile picture is empty)
Then set the value of their profile picture fields to be the URL of the default value profile picture.

I hope that was helpful, but please don’t hesitate to let me know if you have any questions!

Once that workflow has been run one time in your app’s live environment, then you can delete the page and push that change to live again as well (so the page and workflow do not run again).

I hope that’s helpful but please let me know if you have any questions at all!