Using the following libraries in Ravel,
I have confirmed that the file can be uploaded to Firebase storage.
https://github.com/kreait/laravel-firebase
Official Documentation
https://firebase-php.readthedocs.io/en/stable/cloud-storage.html
(Isn't this site helpful at all?)
The code looks like this.
storage=app('firebase.storage');
$bucket=$storage->getBucket();
$object = $bucket->upload(
fopen(public_path().'/storage/thumbnail/'.$file->hashName(), 'r')
);
If you check the storage of firebase from the console, the uploaded file exists.
When I try to open it, it becomes loaded and I cannot see the image itself.
1. The file is uploaded, but I can't see it,
The public URL is not generated either because you can specify options when uploading something, or
Do I need to set up permissions on the Firebase side?
2. If I can upload it in a public state, how can I get a public URL?
I checked the official document and the source, but it got stuck, so I would appreciate it if you could give me some advice.
Thank you for your cooperation.
Self-resolved.
I referred to the code in the sample below.
https://github.com/jeromegamez/firebase-php-examples
$storage=app('firebase.storage');
$bucket=$storage->getBucket();
$object = $bucket->upload(
fopen(public_path().'/storage/thumbnail/'.$file->hashName(), 'r'),
[
'predefinedAcl' = > 'publicRead'
]
);
$downloadUrl="https://storage.googleapis.com/".$backet->name().'/'.$object->name();
Added options and uploaded.
I was able to get the download URL.
However, when I try to see the uploaded image on the Firebase console, it is read and not displayed.
I wonder if this part is a bug.
578 Understanding How to Configure Google API Key
610 GDB gets version error when attempting to debug with the Presense SDK (IDE)
912 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
572 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
617 Uncaught (inpromise) Error on Electron: An object could not be cloned
© 2024 OneMinuteCode. All rights reserved.