Creating my own image selection pop-up

Hey bubble community. I have a database which helps my clients create pdf documents from database items. I have a page that exports to pdf with text and images, which pull from my database and I am trying to figure out how to create a pop-up that will allow users to click on a photo and change the image (in the database and therefore on the page). The trick here is that I don’t want to use an image uploader. I want users to be able to search the images on the database and choose from those.

So far, I have successfully created a reusable pop up element which can search, filter, and preview images using custom states. The problem, however is in getting it to save the selected image that is selected in the pop up in the proper field. I can manage this if the pop up is not reusable and just manually tell it to save image to that specific field, but I need this to be repeatable and usable for every image on my page. Here is how it is currently setup:


This is the workflow for clicking the image (for clarity, we’ll call this “Photo 1”. Clicking Photo 1 on my pdf export page triggers a workflow to show the “search images” popup and then displays the data from Photo 1. Right now, the image is dynamic, pulling from the database item’s “photo 1” field.



This is the workflow for my reusable popup element, which is content type: image. In this popup, I have a repeating group of images and when the user clicks an image, it triggers this workflow, which sets the custom state “selected image” to the image clicked and displays that image below.


This is the workflow that should save the “selected image” back to the database. The problem here is that I want to save it to its parent group, which would be whatever image the user had originally clicked to pull up the pop-up. I think that explains it clearly. any help would be great.

1 Like

Hello
I hope I understood the explanation correctly.

Since you have given so many instructions, you are probably not willing to give me access to the editor. it’s true? :upside_down_face:
By accessing the editor, it is much easier to understand the problem.

But according to what I have found so far, there are some things that might be the problem:

  1. When the type of state is a custom data type, it will only display the data that is stored in the database. In other words, we cannot set the item directly in the asset.

  2. The name of the custom data type you choose is “image”, and it may be confused with the default image data type in a part and cause an error.

To be able to use reusable element data, in addition to the source of the element itself, you have other options. You can use URL parameters and depending on what you want to do, you can also use backend workflow.

This topic was automatically closed after 70 days. New replies are no longer allowed.