Context
Currently, I am uploading an image to Firebase after selecting it using a file input. The process involves using the default settings on the Firebase resize image extension, which resizes the images to 200x200 with no specified file path or folder.
Issue
While browsing through similar posts, I haven't come across a satisfactory answer on how to obtain the downloadURL post resizing the image. Could someone guide me on this particular scenario?
Thank you!
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;
});
},
);
},