Esempio n. 1
0
 * Date: 15-2-9 下午4:29
 * Description:
 */
include_once dirname(__FILE__) . "/SignaturePad.php";
$path = '{"timestamp":"[1423557139692,1423557139695,1423557139712,1423557139749,1423557139763,1423557139765,1423557139780,1423557139797,1423557139799,1423557139809,1423557139825,1423557139842,1423557139849,1423557139849,1423557143346,1423557143351,1423557143376,1423557143414,1423557143426,1423557143443,1423557143460,1423557143464,1423557143465,1423557143642,1423557143642,1423557143692,1423557143709,1423557143726,1423557143743,1423557143760,1423557143777,1423557143794,1423557143811,1423557143828,1423557143844,1423557143861,1423557143878,1423557143895,1423557143912,1423557143929,1423557143946,1423557143963,1423557143980,1423557143997,1423557144014,1423557144031,1423557144048,1423557144064,1423557144081,1423557144098,1423557144115,1423557144132,1423557144149,1423557144166,1423557144183,1423557144200,1423557144216,1423557144233,1423557144250,1423557144267,1423557144284,1423557144301,1423557144318,1423557144334,1423557144351,1423557144368,1423557144385,1423557144403,1423557144419,1423557144436,1423557144453,1423557144470,1423557144487,1423557144494,1423557144494,1423557144631,1423557144631,1423557144673,1423557144690,1423557144707,1423557144724,1423557144741,1423557144758,1423557144775,1423557144792,1423557144808,1423557144825,1423557144842,1423557144859,1423557144874,1423557144875,1423557144876]","coord":"[398.0,186.0,398.0,186.0,399.0,187.0,403.0,189.0,502.0,235.0,529.0,245.0,551.0,253.0,587.0,262.0,599.0,265.0,607.0,267.0,619.0,270.0,624.0,272.0,624.0,272.0,-1.0,0.0,134.0,118.0,134.0,118.0,134.0,120.0,141.0,122.0,149.0,123.0,157.0,125.0,165.0,127.0,165.0,127.0,-1.0,0.0,109.0,259.0,109.0,259.0,113.0,259.0,117.0,259.0,121.0,259.0,126.0,261.0,130.0,266.0,134.0,281.0,140.0,308.0,143.0,339.0,145.0,368.0,146.0,388.0,146.0,400.0,146.0,407.0,146.0,411.0,146.0,413.0,146.0,414.0,150.0,406.0,162.0,372.0,178.0,319.0,194.0,264.0,211.0,220.0,226.0,180.0,238.0,154.0,244.0,139.0,247.0,133.0,248.0,131.0,249.0,131.0,249.0,133.0,253.0,136.0,274.0,136.0,301.0,129.0,334.0,119.0,350.0,116.0,357.0,118.0,359.0,136.0,339.0,192.0,309.0,253.0,272.0,313.0,249.0,350.0,240.0,370.0,237.0,376.0,238.0,378.0,266.0,365.0,307.0,339.0,347.0,318.0,373.0,306.0,388.0,301.0,393.0,301.0,394.0,302.0,394.0,302.0,-1.0,0.0,312.0,270.0,312.0,270.0,312.0,272.0,314.0,278.0,320.0,299.0,327.0,334.0,331.0,372.0,329.0,406.0,323.0,438.0,316.0,467.0,307.0,493.0,295.0,516.0,282.0,535.0,272.0,547.0,269.0,551.0,269.0,551.0,-1.0,0.0,-1,-1]"}';
$path_json = json_decode($path, true);
$coord_json = json_decode($path_json["coord"], true);
$timestamp_json = json_decode($path_json["timestamp"], true);
//var_dump($coord_json);
//var_dump("-------------<br/>");
//var_dump($timestamp_json);
//exit();
//var_dump($t_json);
//var_dump($coord_json);
//exit();
reproduce($coord_json, $timestamp_json, null, null);
function reproduce($coords, $timestamps, $width, $height)
{
    $signaturePad = new SignaturePad();
    $stroke_count = 0;
    for ($i = 0; $i < sizeof($coords); $i = $i + 2) {
        $x = $coords[$i];
        $y = $coords[$i + 1];
        //var_dump($x, $y);
        if ($x == -1 && $y == 0) {
            //一笔结束
            $signaturePad->clear();
            $stroke_count++;
            //            if ($stroke_count == 1) {
            //                //debug
            //                header("Content-type: image/png");
Esempio n. 2
0
<?php

function reproduce($code)
{
    $template = eval($code);
    return $template(array());
}
echo reproduce('return function () {
    return (function() {return "first\\n";})();
};');
echo reproduce('return function () {
    return (function() {return "second\\n";})();
};');