Context
I am passing an image from a file input an then uploading that image to firebase. I am using the all the default settings on the firebase resize image extension so the images are resizing to 200x200 and there's no file path or folder.
Problem
I have seen a few post similar to this question but there are not any good answers on how to get the downloadURL once you resize the image. Can you please explain how I would do this in this circumstances?
Thanks so much!
sendImageToFirebase(image, userId) {
const imageName = image.name;
const extension = image.type.split('/')[1].trim();
const imageSize = image.size;
const metadata = { contentType: image.type, name: imageName, size: imageSize };
const storageRef = storage.ref(`posts/${userId}/${imageName}.${extension}`);
const uploadTask = storageRef.put(image, metadata);
uploadTask.on('state_changed', (snapshot) => {
// Snapshot data ...
}, (error) => {
// Error Handling ...
}, () => {
uploadTask.snapshot.ref.getDownloadURL().then((downloadURL) => {
this.photoUrl = downloadURL;
});
},
);
},