0

I'm building an iOS app which shows an image gallery (read only) to the user. These images would be uploaded to Firebase storage manually (no cms, web admin panel). Whenever a new image is added / deleted / modified at Firebase storage, the app should be able to show the updated content (just like Firebase realtime database).

I have checked similar questions related to downloading a file by creating reference to firebase storage through file url. In my case how the app will keep track of the hardcoded urls as images could change and new images could be uploaded.

1) One possible way is to create Image type database with url of each image and metadata saved into it, and that database should be synced with iOS app.

but again images are uploaded to the storage manually so how that reference could be saved into the database?

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
user3404693
  • 555
  • 1
  • 8
  • 19

1 Answers1

0

As you might have seen, Firebase Storage currently doesn't have an API to retrieve a list of images: How to get an array with all pictures?

That means indeed you'll need to keep the list of images elsewhere. The Firebase Database is a good place to do that, since it also allows you to instantly synchronize changes to all connected users.

To see a simple example of an app that stores (user-generated) images in Storage and then lists them in the Database, see the app we live-coded at I/O: Zero to App.

But as you already said, you will manually add the files to Storage, so a programmatic way to then add the URL doesn't help.

One way to do this manually:

  1. upload the image to Firebase Storage
  2. copy the download URL for you image from the File Location panel of the file
  3. go to the list of images in the database
  4. create a new child under this list, for example based on time: 20160809
  5. paste the download URL as the value
Community
  • 1
  • 1
Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807