So Im trying to upload images from photo library to a server with alamofire
post method, the uploading parts is working. However it's when I convert the UIImage
to Base64
before uploading that stripes/removes all the exif information from the image.
Before converting the UIImage
to Base64
all exif information is there and accessible but after the conversion the exif information is removed. I have tried uploading a Base64
of the same UIImage
but converted on a website and that kept the exif information, that proves that the problem is with the swift version of the conversion.
Here is what the converting part of the code looks like:
func imageTobase64(image: UIImage) -> String {
var base64String = ""
let cim = CIImage(image: image)
if (cim != nil) {
let imageData = image.jpegData(compressionQuality: 1.0)
base64String = imageData!.base64EncodedString(options: NSData.Base64EncodingOptions.lineLength64Characters)
}
return base64String
}