working imagestring: https://goonlinetools.com/snapshot/code/#kzyv3672xr9bawpu4gwyjq
I need image as base64String to send in api service call so tried below code but this op string is giving error but above mention string working.. whats the difference? how to get like above
code:
imagePickerExt.showImagePicker(allowsEditing: false) { (image, imageExtension) in
if let image = image, let imageExtension = imageExtension {
if let base64String = convertImageToBase64String(img: image, imageExtension: imageExtension) {
let cleanedBase64String = base64String
.replacingOccurrences(of: " ", with: "")
.replacingOccurrences(of: "n", with: "")
print("Selected image as cleaned Base64 String: (cleanedBase64String)")
selectedImageFather = image
let fatherPhoto = StudentIDCardViewModel.PhotoDetails(attachment: cleanedBase64String, fileExt: imageExtension)
}
}
}
o/p: there is so much of data but i couldn’t copy and paste whole string so for sample i have added some lines but whats the difference b/w above string and this… why above code working and this one not working… how to get above kind of value to pass in service call?? where am i wrong? plz guide
https://goonlinetools.com/snapshot/code/#7sf2hjsv0ytx9ut2nsepsr