Skip to content
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

"IMAGE_NOT_DECODED" #42

Closed
tgoh1 opened this issue Jul 2, 2016 · 1 comment
Closed

"IMAGE_NOT_DECODED" #42

tgoh1 opened this issue Jul 2, 2016 · 1 comment

Comments

@tgoh1
Copy link

tgoh1 commented Jul 2, 2016

Hi
I've started building apps only recently.I am building an app that takes a picture and compares the image with the images I have already uploaded in the pastec database.

I am currently developing the app with ionic 2 with the Pastec api.

I am able to take a photo and send the photo to the server.
Pastec reflects my search requests however I always get the error "IMAGE_NOT_DECODED" .

The following is my code.

scan() {

    var options = {
        destinationType: Camera.DestinationType.DATA_URL,
        sourceType: Camera.PictureSourceType.CAMERA,
        quality: 75,
        allowEdit: false,
        saveToPhotoAlbum: false
    };

    Camera.getPicture(options).then((imageData) => {
        let base64Image = "data:image/jpeg;base64," + imageData;
        console.log(imageData);
        this.cameraSuccessCallback(imageData);

    }, (err) => {
        alert(err);
    });
};

cameraSuccessCallback(imageData) {
    console.log('called camera success callback');

    let data = this.getApi(imageData);

    data.subscribe(
        res => {
            console.log(res);
        }
    )
};

getApi(imageData) {
    console.log('called getapi');

    let headers = new Headers({
        'AuthKey': 'my auth key'
    });

    let options = new RequestOptions({ headers: headers });

    return this.http.post(
        "https://api.pastec.io/indexes/vygfzrfgnqjwmmzzcvae/searcher",
        imageData,
        options).map(res => res.json());
}

};

@magwyz
Copy link
Owner

magwyz commented Nov 7, 2016

Closing the issue as it does not seem to be a Pastec problem.

@magwyz magwyz closed this as completed Nov 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants