Right way to show images stored in firebase.storage? -
when user uploads , image, app saves in firebase storage , gets download-url , saves in database. use url in database show image gets really slow (< 2 seconds) show image. on other hand, firebase database blazing fast.
is correct way show images or doing non performant?
edit: have seen other posts have slowness issues none of them seem have solution (example). live in europe , storage in us. images under 400kb, shouldn't issue.
code:
// creating reference const imageref = firebase.storage().ref(`/jobs/${currentuser.uid}/${jobuid}`).child(name) // creating blob using filereader fs.readfile(uploaduri, 'base64') .then((data) => { console.log('data readfile: ', data) return blob.build(data, { type: `${mime};base64` }) }) .then((blob) => { uploadblob = blob; return imageref.put(blob, { contenttype: mime, name: name }) .then(url => { // url used display image let imgurl = url.downloadurl // upload url database let storageref = firebase.database().ref(`/jobs/activejobs/${currentuser.uid}/${jobuid}/`); storageref.update(photo1).then(() => console.log('success'))
to retrieve image place downloadurl in image tag
wiki
Comments
Post a Comment