2
votes

I am building application using Laravel 5.2, I have connected it with firebase storage to store files there. every thing is working fine, but when I get an image from firebase it only returns below array without any downlabable link

"type" => "file"
  "dirname" => "FUEL"
  "path" => "FUEL/Kaleem.jpeg"
  "timestamp" => 1507750905
  "mimetype" => "image/jpeg"
  "size" => "129335"

But when I go firebase console it gives me the download link similar to following

https://firebasestorage.googleapis.com/v0/b/fuel.appspot.com/o/fuel%2F1?alt=media&token=41c1d708-7bc2-41b4-86cf-2536062a261c

Is there any way to get downloadUrl of an image from firebase storage using PHP?

1

1 Answers

4
votes

You should be able to download with the help of Google Cloud Storage APIs, especially the PHP SDK.

Or, you can build your own download URL. For this, you'll need to allow the object to be publicly readable ( allow read; ), percent encode your file path and the object will be available through a url with the following format: https://firebasestorage.googleapis.com/b/<YOUR_BUCKET>/o/<PERCENT_ENCODED_PATH_TO_FILE>?alt=media