Created
May 19, 2021 03:04
-
-
Save m3l1nd4/9ac09f4bd9f7fdc11d1c7d3b24c29936 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Display Thread/Comment Image | |
const displayImage = (folder, id, element, background) => { | |
const ref = firebase.storage().ref(folder); | |
const name = id + '.jpg'; | |
ref.child(name) | |
.getDownloadURL() | |
.then(url => { | |
(background) | |
? document.getElementById(element).style.backgroundImage = 'url(' + url + ')' | |
: document.getElementById(element).src = url; | |
}).catch(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment