I’m looking for the best option to let user upload pictures to form a picture gallery in the profile page.
I am using a repeating group with an image element, but I can’t figure out how to add the functionality to let user add or delete pictures from this group.
At present moment I am only able to upload pictures to database by myself.
To enable your users to add a picture, add a picture uploader element somewhere on that page. Once they uploaded an image via the picture uploader element, you would then save the picture uploader’s value to your database. You could trigger a workflow using a button or other methods
To delete a picture in the RG, you could add a button in the rg or simply attach a workflow to the image wherein if the image is clicked, you would run a workflow that deletes the image in the image field of your data type
Note: Simply removing the image in a datatype’s field doesn’t entirely delete an image. You would need to run a workflow where you would delete the uploaded file in your s3 storage. Simply referencing to the image or the image’s URL in this action would delete it entirely
I have one case in my app where the user can upload up to 25 different images. In this case, I have a repeating group which contains the 25 “spots” they can upload images into:
If they want to delete the image, they just click the trash can icon and I just set the value of that row’s image field to empty (the advice you got about having to delete the image’s URL applies here).
I also have another case where the user can upload as many images as they want. In this case, I have an RG which displays all the images they uploaded. Right above it I have a button labelled “upload images” which starts a popup. In the popup which uses the Multi-fileuploader to let the user select all the images they want to upload.
This RG also has the trashcan icon to let the user delete the image. Here, the delete icon actually deletes the RG’s row (as well as handles deleting the URL file).