PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, July 30, 2022

[FIXED] How do I store images on Google Firebase?

 July 30, 2022     firebase, firebase-realtime-database, google-cloud-firestore, image     No comments   

Issue

How do I store images on Google Firebase and which solution do I use?

Background
I am looking to create a web app (Python, HTML & JS) that uses Google's Firebase for the backend storage. I believe that the Realtime Database will be sufficient for my needs (the website is in e-commerce style) but am trying to store profile pictures for the users. I am aware that images can generally be stored as blurbs. I haven't been able to figure out whether the Realtime Database, Cloud Firestore or Cloud Storage is most appropriate.

Request
Please explain which would be more capable, why and how it can be implemented.


Solution

There are a couple of options:

Thumbnails

You can store small thumbnails as Base64 encoded strings within the RTDB or Cloud Firestore. The benefit is that you can retrieve the profile picture in the same request. The downside is that the browser will need to do a little more work to render the images.

Standard sized images

You should use Cloud Storage for anything other than the tiniest blobs. You can either fetch these directly (as JPG or PNG) using client-side JS (from the browser) or pass them in your response payload, if you intend to use Server Side Rendering with Cloud Functions.

Language support

Cloud Functions for Firebase do not currently support Python. In order to implement a Python based back-end, you will need to deploy using gcloud functions deploy for each function. If you intend to build a SSR application, you may want to look at using a framework, such as Next or Nuxt, which you can deploy directly with the Firebase CLI.



Answered By - Jason Berryman
Answer Checked By - Clifford M. (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing