This is how I upload to Firebase. But it takes a while to fetch it back. Also while saving it too, that's why I tried asynchronising the process.
if imagePathToUpload != nil {
let uploadImgPath = Firebase(url:"\(rootURL)/users/\(id!)")
let imageData = UIImagePNGRepresentation(image)
let base64String = imageData!.base64EncodedStringWithOptions(.Encoding64CharacterLineLength)
let imageRef = uploadImgPath.childByAppendingPath("\(path!)")
dispatch_async(dispatch_get_main_queue(), {
imageRef.setValue(base64String)
})
}
The image size is 370x370 so it shouldn't take that long in my opinion. or should I try to smaller the image before I upload it?
What is the proper way of handling image storage to Firebase?