Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add image data and path in fb #37

Merged
merged 6 commits into from
Dec 30, 2020
Merged

Add image data and path in fb #37

merged 6 commits into from
Dec 30, 2020

Conversation

c3pobstler
Copy link
Collaborator

No description provided.

@vercel
Copy link

vercel bot commented Dec 16, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/ndrsllwngr/omm/fmfjuz4a8
✅ Preview: https://omm-git-upload-images.ndrsllwngr.vercel.app

Comment on lines 12 to 39
useEffect(() => {
// references
const collectionRef = memeFirestore.collection('templates')
const id = collectionRef.doc().id
const storageRef = memeStorage.ref().child('templates').child(id)
const documentData = {
created_at: firebase.firestore.Timestamp.now(),
img: 'templates/' + id,
name: file.name,
}

storageRef.put(file).on(
'state_changed',
(snap) => {
let percentage = (snap.bytesTransferred / snap.totalBytes) * 100
setProgress(percentage)
console.log('precentage:', percentage)
console.log('document:', documentData)
},
(err) => {
setError(err)
console.log(err)
},
async () => {
const url = await storageRef.getDownloadURL()
await collectionRef.add({ documentData })
setUrl(url)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, reference the source of the code 😄

bug with gallery: continuous rerender - needs to be fixed
screenshot not fully functional yet
missing snap function
@maxrawlinger maxrawlinger merged commit d3937f8 into main Dec 30, 2020
@maxrawlinger maxrawlinger deleted the upload-images branch December 30, 2020 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants