phonegap image base64 android

I want to send a picture taken from the camera to a server as a base64 string. My problem is that the picture gets corrupted somehow in the phone.

I have some console.logs to print the base64 string inside the success function of the camera.getPicture, and whenever I print the string and the decode the image, it only shows the top part, as if it was incomplete.

Here is my code:

photo.capturePhoto = function(image_button_id) {
        navigator.camera.getPicture(function(image) {
            photo.onPhotoDataSuccess(image)
        }, onFail, {
            quality : 30,
            destinationType: destinationType.DATA_URL,
            correctOrientation : true
        });
    }

and the success function:

photo.onPhotoDataSuccess = function(image) {
        console.log(image); //What this prints is an incomplete image when decoded
    }

What is wrong with this code?

This is a example image when decode with: http://www.freeformatter.com/base64-encoder.html

I'm using phonegap 2.2.0

我来评几句
登录后评论

已发表评论数()

相关站点

+订阅
热门文章