简体   繁体   中英

Camanjs filter done callback (events in camanjs)

I try to understand events in camanjs , but I need some examples. Can everyone write me simple example about this:

1) load image in to canvas (done)

Caman("#canvas-img2", base64_or_path_to_image, function () {
    this.nostalgia();
    this.render();
});

2) listen to end filtering, for callback with this.toBase64()

In docs, I found event page, but don't understand how it works.

It was simple! Put callback in render, like this (I need to send base64 data to backend):

Caman("#canvas-img2", base64_or_path_to_image, function () {
        this.vintage();
        this.render(function() {
            FACE.camanPhoto = this.toBase64();
            base64Data = FACE.camanPhoto.replace(/^data:image\/png;base64,/,"");
            sendDataToServer();
        });
    })

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM