I have an app to register products and edit.
The registration part works correctly, it generates in Firebase the data in the bank and in Storage the photo that was selected.
To “link” the image with my database data, I used the name of the image generated in the idFoto field of the database. Thus, I have a “bond”.
In my “edit product” screen, I load the data and this part is ok.
My problem is when I want to edit this image.
At the first moment, it loads the already selected image (the one that is already in my registry).
I put an option when the user clicks on the image, open a condition of: “take photo” or “pick image from library”.
Until then it works correctly.
However, when I select the new image, it’s not updating in my preview on the page (before sending it to Firebase).
What should I do?
My logic is as follows:
Here I resize the image, open the open editor and then set the page variables:
And then the others:
My photo name variable is idFoto:
Which comes from my database.
Where am I going wrong?
If I understand well, after upload, use a get record to fetch the updated data with the new image and it will display in the preview.
Hello friend, so in this part I still haven’t uploaded the photo to the storage.
This would be my registry edit screen.
It loads with the current photo that’s in my database.
It should update the preview and then record in the bank over this photo that already exists and not create a new photo.
Is there any tutorial on how to update and delete images that are in firebase storage?
I didn’t understand your issue at first.
You mean you want to overwrite the previous image? If so, use this formula in the image name field so that the newly uploaded image overwrites the previous one. The condition is for all images to have the exact same name (eg: ‘user’) so the overwrite happens well.
REPLACE_ONE(LOOKUP(source.item, "name"), LOOKUP(source.item, "name"), "user."+LEFT_STRIP(source.item.mimeType, 6))
Hi all, I think I can explain myself better with these screens…
I have a list from my firebase database
When I select one of these items and click to edit, it calls an edit page for this item:
So far ok, he is bringing it correctly.
However, if I click on the image to select another image from my device, it is not updating that image on this screen.
It updates correctly in the database and on the previous list screen.
But the preview here on this screen is not happening.
My image component is like fetching data.variable from my database, because when it starts editing I need to show the current photo.
This point also works correctly.
However, after reducing the image and opening the open editor, I perform the set page variable, with the variable “urlFoto” = the path of the open image editor.
And another “set page variable” with:
product.photo = which is where I have my photo variables to send to firebase later.
When I select the image, the current image disappears from the preview, and the new one is not shown.
Can you help me with this?
This is how your flow should look like, more or less. Have a set pageVar right after your upload for holding the new pic with the download url as the assigned value:
outputs["Firebase Storage upload files"].files.downloadUrl