I would advise you to use firebase AUTH, to authenticate your user and use your facebook, or google+ profile photo automatically. But if you want to use a photo chosen by the user, you must use firebase Storage,and retrieve that url from your user’s node at the same time.If you do this free course,:firebase wekend course
What you’ll see on the course:
Uri selectedImageUri = data.getData();
// Get a reference to store file at firebase storage/<FILENAME>
StorageReference photoRef = mChatPhotosStorageReference.child(selectedImageUri.getLastPathSegment());
// Upload file to Firebase Storage
photoRef.putFile(selectedImageUri)
.addOnSuccessListener(this, new OnSuccessListener<UploadTask.TaskSnapshot>() {
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
// When the image has successfully uploaded, we get its download URL
Uri downloadUrl = taskSnapshot.getDownloadUrl();
// Set the download URL to the message box, so that the user can send it
// to the database
FriendlyMessage friendlyMessage = new FriendlyMessage(TEXTO, NOME-DO-USUÁRIO, downloadUrl.toString(),DADOS-DO-USUÁRIO.............);
mMessagesDatabaseReference.push().setValue(friendlyMessage);
}
Thank you very much Oto! Sensational the tip of the course and the excerpt of the code, helped me and for sure will be very useful for other people too !
– Eduardo Rafael Moraes
Hello. To use with Ionic 3 would have some example?
– Ezequiel Tavares
unfortunately not @Ezequieltavares ,I do not use this development platform.
– Oto Campos