I would advise you to use AUTH firebase, to authenticate your user and use facebook profile photo, or google + automatically. But if you want to use a photo chosen by the user, you should use firebase Storage, when to send the message to the database, you will send the user image to the firebase storage, and retrieve that url on your user's node at the same time.If you do this free course, you will be able to do this operation quietly: course firebase wekend
What you'll see in 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);
}