-
-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ImageBlob not working in android #62
Comments
I'm guessing that the data is the wrong format when posting, the image data field should not start with
Maybe it's submitting the |
Great Ruddell! it worked! |
@ruddell Do you think I need to change the code for both iOS and Android or just Android? |
I think the best way to implement should be upload a photo and read the link as they say here ... For now my current code for photo ionic4 is, employee.ts
employee.html
I have generated only for android. I set the destination type to data URL (Camera.DestinationType.DATA_URL), but this returns the file contents as a base64 encoded string and that increases the file size about 30%. so the best practice should be as the link above (I think) URI ... |
I believe this is fixed by #91. Please re-open if it's not. |
I can upload a new photo in Web environment, but when I generate the apk and tried to save a photo in android device it gives this error.
o.z.problem.spring.common.AdviceTrait : Bad Request: JSON parse error: Cannot deserialize value of type
byte[]from String "image/jpg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBA....
The above exception comes in when the property is of type byte[] and json content is represented in String. Jackson thinks that in this case the json data is represented as base64 encoded and tries to decode it to a byte[]. If the string present in data field isn't a properly encoded base64 string, jackson raises the above exception.
Do I have to change something in the Spring class ? Like ...
return (Base64.getEncoder().encode(jsonParser.getText().getBytes()))
or
write images as text in database and send base64 string to server. Like described here
stackoverflow.com angular-5-how-can-i-save-a-user-with-a-blob-avatar
or save just the name of the avatar and get the image to show after like described here?
brianflove.com/2017/11/02/angular-http-client-blob/
All suggestions are very welcome :-)
The text was updated successfully, but these errors were encountered: