Bad Addy
Posts: 0
Joined: Fri Dec 13, 2013 9:34 pm

Camera base64

I am not sure what it is, but if i get a image and decode it into base64, its a massive string. When the camera on my phone does via the app and Camera Service, the string is small. Here is what it does:

REQUEST:
Image

RESPONSE:
Image

This is what is added to the database:

pre
213 9 data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAAAcIAAAHCCAYAAAB8GMlFAAAAHGlET1QAAAACAAAAAAAAAOEAAAAoAAAA4QAAAOEAA7l6yqqo/QAAQABJREFUeAFEvWeTHNe1tckfOBET970SJXoABEDCuwbQ3ntT1aZsep/lugHQG5CS6ERKonTv1cTMz9nzrFPg+344kVlZmVnZBUQ+tdZe++Rr1ehXGwz/bmX5V4vT7y3Lf7Lh
/pre

So it's missing a lot. I am not using a REST by mySQL, so its getting passed to a PHP script. But even going to the PHP the data is tiny.

The image does not show when i retrieve it:

Image

If I check the code I get this note:

pre
The particular error here was:

The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters./pre

Any ideas please ?

Bad Addy
Posts: 0
Joined: Fri Dec 13, 2013 9:34 pm

Camera base64

UPDATE:

If I take the code direct from the camera and console.log it into the console at the same time its put into the IMG tag. I do get much more data, but if i copy and paste it into the Base 64 Decode, it still is telling me its not vaild. Even though it does show in the image box on the phone ?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Camera base64

Hi Addy,

Map ImageDataBase64 to image asset, this should be working.
Don't you see it? What is your device OS version?

As for passing base64 to your server, what request type do you use (post, get, put)?

Bad Addy
Posts: 0
Joined: Fri Dec 13, 2013 9:34 pm

Camera base64

If I pass the camera img from the service to the image component to preview the image, it works fine. And the base64 is long, as you would expect when i console.log it.

But, for someone reason, when i try and decode the base64 code on an external website, it says it's not valid.

When I send the information to the PHP to then post it to the website, it does not send all of the base64 string. I am using a service to send it, and its going via POST.

Bad Addy
Posts: 0
Joined: Fri Dec 13, 2013 9:34 pm

Camera base64

No matter what I try, I cannot get the whole base64 sent via a service / ajax to a php script. If you can do this via on Appery, please can you explain how.

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Camera base64

Hello,

Have you tried to implement this example?
http://docs.appery.io/tutorials/using...

Return to “Issues”