Estoy tratando de actualizar el código de la versión 8 a la versión 9, pero la imagen que se carga produce Error loading preview ...
Aquí está el código:
async storeImage(img: { uri: string; base64: string }, userId: string) { try { let imageUrl = null; const imageName = img.uri.substring(img.uri.length - 40); const imageRef = ref(this.storage, `profile-images/${userId}/${imageName}`); uploadString(imageRef, img.base64, 'base64', { contentType: "image/jpg" }).then((snapshot) => { console.log("image stored", snapshot); }) getDownloadURL(ref(this.storage, `profile-images/${userId}/${imageName}`)) .then(url => { const xhr = new XMLHttpRequest(); xhr.responseType = 'blob'; xhr.onload = (event) => { const blob = xhr.response; }; xhr.open('GET', url); xhr.send(); console.log('getDownloadURL', url); imageUrl = url; }) return imageUrl } catch (error) { console.log(error); } } } The uri string is the address on the device, the base64 is /9j/4AAQSkZJRgABAQAASABIAAD/4QBYRXhpZgAATU0AKgAAAAgAAgESAAMAAAABAAEAAIdpAAQAAAABAAAAJgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAyKADAAQAAAABAAAAhAAAAAD/7QA4UGhvdG9zaG9wIDMuMAA4QklNBAQAAAAAAAA4QklNBCUAAAAAABDUHYzZjwCyBOmACZ...
Esta es la URL de la vista previa de almacenamiento de Firebase.
Esta es la URL descargada, que debe ser la misma que la anterior.
Intenté también en uploadString usar base64url pero nada.
Se agradece cualquier tipo de ayuda.
Gracias por adelantado.