Integration


First upload lollipop folder to your server so it is accessible from your existing project. Includelollipop-integrate.jsin your project.
Follow the documentation project to know more about integration (take a look atdemo.js)

var imageEditor = Lollipop.setOptions({
    path: "lollipop",
    appendTo: "body",
    onSave: function (data) { 
        // Replace original image with edited image
        Lollipop.image.src = data;
        // Upload edited image to the server
        $.ajax({
            type: 'POST',
            url: './saveImage.php',
            data: {
                imgData: data
            },
            success: function(response) {
                Lollipop.setNewImageUrl(response);
                alert('Image saved successfully!, You can share it now on social media');
            }
        });
    }
});
// Open the image editor when you click on the magic icon
$(".magic").each(function () {
    $(this).on("click", function () {
        var img = $(this).parents().siblings("img");
        imageEditor.open({
            image_url: img[0].src
        }, img[0]);
    });
});