Skip to content

Instantly share code, notes, and snippets.

@m3l1nd4
Created May 19, 2021 03:04
Show Gist options
  • Save m3l1nd4/9ac09f4bd9f7fdc11d1c7d3b24c29936 to your computer and use it in GitHub Desktop.
Save m3l1nd4/9ac09f4bd9f7fdc11d1c7d3b24c29936 to your computer and use it in GitHub Desktop.
// 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