{"action":"opened","issue":{"url":"https://api.github.com/repos/Foliotek/Croppie/issues/79","repository_url":"https://api.github.com/repos/Foliotek/Croppie","labels_url":"https://api.github.com/repos/Foliotek/Croppie/issues/79/labels{/name}","comments_url":"https://api.github.com/repos/Foliotek/Croppie/issues/79/comments","events_url":"https://api.github.com/repos/Foliotek/Croppie/issues/79/events","html_url":"https://github.com/Foliotek/Croppie/issues/79","id":134611112,"number":79,"title":"how to work with Ajax data to php","user":{"login":"geranjian","id":4043779,"avatar_url":"https://avatars.githubusercontent.com/u/4043779?v=3","gravatar_id":"","url":"https://api.github.com/users/geranjian","html_url":"https://github.com/geranjian","followers_url":"https://api.github.com/users/geranjian/followers","following_url":"https://api.github.com/users/geranjian/following{/other_user}","gists_url":"https://api.github.com/users/geranjian/gists{/gist_id}","starred_url":"https://api.github.com/users/geranjian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geranjian/subscriptions","organizations_url":"https://api.github.com/users/geranjian/orgs","repos_url":"https://api.github.com/users/geranjian/repos","events_url":"https://api.github.com/users/geranjian/events{/privacy}","received_events_url":"https://api.github.com/users/geranjian/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-02-18T15:27:53Z","updated_at":"2016-02-18T15:27:53Z","closed_at":null,"body":"good day\r\n\r\nthis is my html\r\n\r\n<!DOCTYPE html>\r\n<html lang=\"pt-br\">\r\n<head>\r\n<meta charset=\"utf-8\">\r\n<title>Test</title>\r\n<link href=\"css/croppie.css\" rel=\"stylesheet\" type=\"text/css\">\r\n<script type=\"text/javascript\" src=\"http://code.jquery.com/jquery-1.12.0.min.js\"></script>\r\n<script type=\"text/javascript\" src=\"js/croppie.js\"></script>\r\n<script type=\"text/javascript\">\r\n$( document ).ready(function() {\r\n    var $uploadCrop;\r\n\r\n    function readFile(input) {\r\n        if (input.files && input.files[0]) {\r\n            var reader = new FileReader();          \r\n            reader.onload = function (e) {\r\n                $uploadCrop.croppie('bind', {\r\n                    url: e.target.result\r\n                });\r\n                $('.upload-demo').addClass('ready');\r\n            }           \r\n            reader.readAsDataURL(input.files[0]);\r\n        }\r\n    }\r\n\r\n    $uploadCrop = $('#upload-demo').croppie({\r\n        viewport: {\r\n            width: 200,\r\n            height: 200,\r\n            type: 'scuere'\r\n        },\r\n        boundary: {\r\n            width: 300,\r\n            height: 300\r\n        }\r\n    });\r\n\r\n    $('#upload').on('change', function () { readFile(this); \r\n        $(\".crop\").show(); \r\n              \r\n    });\r\n    $('.upload-result').on('click', function (ev) {\r\n        \r\n        $uploadCrop.croppie('result', {\r\n            type: 'canvas',\r\n            size: 'original'\r\n        }).then(function (resp) {\r\n            $('#imagebase64').val(resp);\r\n            $('#form').submit();\r\n        });\r\n    });\r\n    $('.upload-result').on('click', function (ev) { \r\n            $uploadCrop.croppie('result', 'canvas').then(function (resp) { \r\n                popupResult({ \r\n                    src: resp \r\n                }); \r\n            }); \r\n        }); \r\n         \r\n    function popupResult(result) { \r\n        var html; \r\n        if (result.html) { \r\n            html = result.html; \r\n        } \r\n        if (result.src) { \r\n            html = '<img src=\"' + result.src + '\" />'; \r\n        } \r\n        $(\"#result\").html(html); \r\n    } \r\n\r\n\r\n\r\n});\r\n</script>\r\n</head>\r\n<body>\r\n<form action=\"images.php\" id=\"form\" method=\"post\">\r\n<input type=\"file\" id=\"upload\" value=\"Choose a file\">\r\n<div id=\"upload-demo\"></div>\r\n<input type=\"hidden\" id=\"imagebase64\" name=\"imagebase64\">\r\n<a href=\"#\" class=\"upload-result\">Send</a>\r\n</form>\r\n<div id=\"result\"></div> \r\n</body>\r\n</html>\r\n\r\nand this my php\r\n\r\n<?php\r\n    \r\n    session_start();\r\n    if(isset($_POST['imagebase64'])){\r\n        $data = $_POST['imagebase64'];\r\n\r\n        list($type, $data) = explode(';', $data);\r\n        list(, $data)      = explode(',', $data);\r\n        echo $data;\r\n        $data = base64_decode($data);\r\n\r\n        echo file_put_contents('demo/andres.png', $data);\r\n    }\r\n?>\r\n\r\nas send information for ajax????"}}