title: Swift iOS: ImageUrl in Firebase database
body: <p>My current code for saving the user image in my storage database is:</p>
  
  <p>
  
  <pre><code>            if let uploadData = UIImagePNGRepresentation(self.profileImage.image!)
              {
  
  
                  storage.put(uploadData, metadata: nil, completion: { (metadata, error) in
  
                      if error != nil {
                          print(error!)
                          return
                      }
                      print(metadata!)
                  })
              }
  </code></pre>
  
  <p>So my question here is how do I get the image url back to my firebase database? I have user information that I store in the user.uid as seen below:</p>
  
  <p>
  
  <pre><code>            let ref = FIRDatabase.database().reference(fromURL: "https://databaseURL.firebaseio.com/")
  
              let userReference = ref.child("Users").child(uid)
  
              let values: [String : Any] = ["Full name": name, "Email": email, "Username": username]
  
  
              userReference.updateChildValues(values, withCompletionBlock: { (err, ref) in
  
                  if err != nil {
  
                      return
                  }
  
                  let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil)
  
                  let nextViewController = storyBoard.instantiateViewController(withIdentifier: "Homepage") as! homepageViewController
  
                  self.present(nextViewController, animated:true, completion:nil)
  
                  //stops loading
                  self.loadingIndicator.stopAnimating()
              })
  </code></pre>
  
  <p>So how do I store the image URL into this JSON that I have for each user?</p>
  
  <p>Rules:</p>
  
  <pre><code>{
  
  "rules":
   {
  
  ".read": "auth != null",
  
  
  ".write": "auth != null"
  }
  
  }
  </code></pre>