How to store "direct link" to an image using Firebase Storage

Asked

Viewed 1,093 times

1

I need to access an image stored in Firebase Storage via a direct link, e.g.:

http://myfirebasehost.com/storage/imgIwant.png

As far as I know, this type of URL is only possible using the protocol gs://, however, it is not accessible by link, only in the SDK api.

I need a solution exactly as described above using the Firebase platform, if not possible, I accept other suggestions.

My code has constants that are links to images. It turns out that if I want to update this image, I have to make a new deploy. Instead I want the image to update to the same URL. It would be impossible to do this with firebase (as far as I know) because the URL provided by Storage is not accessible by link.

Another alternative might be to convert an image to Base64 and store it in the Database, but it would be too long and unviable.

  • You would have immense cache problems with this solution of yours. More interesting would be to update a remote data containing the URL. Text cache is much less persistent.

  • Redirecting does not work in tag img

  • I don’t understand what it has to do with the other.

  • What would be a remote datum?

  • Firebase even generates a persistent link that opens in the browser but for some reason the error with the plugin Cordova social share.

  • A data that is not saved in the application. A data saved in Firebase. Save the URL in Firebase and make your application search for this URL. Then you change the URL when you need to change the photo. This is more interesting than leaving the URL fixed because of the cache problem you will have if you do this.

Show 1 more comment

2 answers

0

I believe what you seek is Download URL (which can also be obtained from the Firebase console).

To not have to make upgrade deploys, you can store this url in your database.

0

Well, the way I did may not be right, but I’ll show you how I did it:

For this I used the getDownloadURL command, for example:

inserir a descrição da imagem aqui

Browser other questions tagged

You are not signed in. Login or sign up in order to post.