UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

How to save lots of images to firebase storage and cloud firestore(with url)?

Forums > Swift

I'm struggling with how to get and save the image url of the pictures to database. I also need to know how to store images with unique names all the time so old images don't get deleted by new ones.

  let storage = Storage.storage().reference()
        guard  let imageData = ecoImage.jpegData(compressionQuality: 0.75) else {
            return
        }

        let metaData = StorageMetadata()
        metaData.contentType = "image/jpg"

            storage.child("pins/\(uid)").putData(imageData, metadata: metaData) { (StorageMetadata, error) in
            guard StorageMetadata != nil else{
                print("oops an error occured while data uploading")
                return
            }
                 print("Image sent")
            }

doc.setData(["uid": uid, "pinLocation": Pin, "time": timeData]) { (error) in
            if error != nil {
                print(error?.localizedDescription)
                return
            } else {
                print("Pin saved")
            }
        }

2      

I not sure about Firebase but this video might help #1 Grocery App - Setting Up Firebase with Xcode 12 and then there #2 as well.

2      

@BlackNoirImpost3 - Did you come up with a working resolution for this in the end?

2      

Hi, i have interpolated my data set. I would like to check which method will be best suited for my data. Reference data for cross validation is missing. Is any other method exit with which i can check which interpolation technique will be best suited for my data set?

2      

BUILD THE ULTIMATE PORTFOLIO APP Most Swift tutorials help you solve one specific problem, but in my Ultimate Portfolio App series I show you how to get all the best practices into a single app: architecture, testing, performance, accessibility, localization, project organization, and so much more, all while building a SwiftUI app that works on iOS, macOS and watchOS.

Get it on Hacking with Swift+

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.