Jump to content

Recommended Posts

I have installed and am using Thomas bradleys Signature pad. I am able to draw my signature but when I press submit I keep getting this error

Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\CareMed\signature-to-image.php on line 52

I am using the full-window template so it only had a clear button. I added a submit button to it.

 

 

This is the main php page that lets me draw my signature.


<html><head>
  <meta charset="utf-8">
  <title>Full-Window · Signature Pad</title>
  <style>
    * {
        -webkit-user-select: none;
        -moz-user-select: none;
        user-select: none;
    }
    html, body {
        min-height: 100%;
        height: 100%;
        max-width: 100%;
        width: 100%;
        overflow: hidden;
    }
    html, body, form {
        margin: 0px;
    }
    html, form {
        padding: 0px;
    }
    html, body, fieldset {
        background: #aaa;
    }
    fieldset {
        position: absolute;
        border: 5px solid #aaa;
        background: #aaa;
        right: 0px;
        bottom: 0px;
    }
    canvas {
        outline: 5px solid #aaa;
        background: #fff;
    }
    input[type=submit], input[type=reset] {
        font-size: larger;
    }
  </style>
  <link rel="stylesheet" href="assets/jquery.signaturepad.css">
  <!--[if lt IE 9]><script src="../assets/flashcanvas.js"></script><![endif]-->
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
</head>
<body>
    <form method="post" action="finaladd.php" class="sigPad">
 
  <div class="sig sigWrapper">
    <div class="typed"></div>
    <canvas class="pad" width="198" height="55"></canvas>
    <input type="hidden" name="output" class="output">
    <fieldset>
            <input type="reset" value="clear" />
            <input type='submit' value='submit'/>
        </fieldset>
  </div>
  <button type="submit">I accept the terms of this agreement.</button>
</form>



  <script src="assets/numeric-1.2.6.min.js"></script>
  <script src="assets/bezier.js"></script>
  <script src="jquery.signaturepad.js"></script>
  <script>
  (function(window) {
    var $canvas,
        onResize = function(event) {
          $canvas.attr({
            height: window.innerHeight,
            width: window.innerWidth
          });
        };

    $(document).ready(function() {
      $canvas = $('canvas');
      window.addEventListener('orientationchange', onResize, false);
      window.addEventListener('resize', onResize, false);
      onResize();

      $('form').signaturePad({
        drawBezierCurves: true,
        variableStrokeWidth:true,
        drawOnly: true,
        defaultAction: 'drawIt',
        validateFields: false,
        lineWidth: 0,
        output: null,
        sigNav: null,
        name: null,
        typed: null,
        clear: 'input[type=reset]',
        typeIt: null,
        drawIt: null,
        typeItDesc: null,
        drawItDesc: null
      });
    });
  }(this));
  </script>
  <script src="assets/json2.min.js"></script>

This is now the page called finaladd.php

 

This is where it ges when I click submit. It is supposed to convert the image into a png and save it as signature.png

<?php

require_once 'signature-to-image.php';

$json = $_POST['output'];
$img = sigJsonToImage($json);

imagepng($img, 'signature.png');
imagedestroy($img);

// Destroy the image in memory when complete

Lastly,

 

This is the signature-to-image.php file that is called from the above file.


<?php
/**
 *  Signature to Image: A supplemental script for Signature Pad that
 *  generates an image of the signature’s JSON output server-side using PHP.
 *
 *  @project ca.thomasjbradley.applications.signaturetoimage
 *  @author Thomas J Bradley <hey@thomasjbradley.ca>
 *  @link http://thomasjbradley.ca/lab/signature-to-image
 *  @link http://github.com/thomasjbradley/signature-to-image
 *  @copyright Copyright MMXI–, Thomas J Bradley
 *  @license New BSD License
 *  @version 1.1.0
 */
/**
 *  Accepts a signature created by signature pad in Json format
 *  Converts it to an image resource
 *  The image resource can then be changed into png, jpg whatever PHP GD supports
 *
 *  To create a nicely anti-aliased graphic the signature is drawn 12 times it's original size then shrunken
 *
 *  @param string|array $json
 *  @param array $options OPTIONAL; the options for image creation
 *    imageSize => array(width, height)
 *    bgColour => array(red, green, blue) | transparent
 *    penWidth => int
 *    penColour => array(red, green, blue)
 *    drawMultiplier => int
 *
 *  @return object
 */
function sigJsonToImage ($json, $options = array()) {
  $defaultOptions = array(
    'imageSize' => array(198, 55)
    ,'bgColour' => array(0xff, 0xff, 0xff)
    ,'penWidth' => 2
    ,'penColour' => array(0x14, 0x53, 0x94)
    ,'drawMultiplier'=> 12
  );
  $options = array_merge($defaultOptions, $options);
  $img = imagecreatetruecolor($options['imageSize'][0] * $options['drawMultiplier'], $options['imageSize'][1] * $options['drawMultiplier']);
  if ($options['bgColour'] == 'transparent') {
    imagesavealpha($img, true);
    $bg = imagecolorallocatealpha($img, 0, 0, 0, 127);
  } else {
    $bg = imagecolorallocate($img, $options['bgColour'][0], $options['bgColour'][1], $options['bgColour'][2]);
  }
  $pen = imagecolorallocate($img, $options['penColour'][0], $options['penColour'][1], $options['penColour'][2]);
  imagefill($img, 0, 0, $bg);
  if (is_string($json))
    $json = json_decode(stripslashes($json));
  foreach ($json as $v)
    drawThickLine($img, $v->lx * $options['drawMultiplier'], $v->ly * $options['drawMultiplier'], $v->mx * $options['drawMultiplier'], $v->my * $options['drawMultiplier'], $pen, $options['penWidth'] * ($options['drawMultiplier'] / 2));
  $imgDest = imagecreatetruecolor($options['imageSize'][0], $options['imageSize'][1]);
  if ($options['bgColour'] == 'transparent') {
    imagealphablending($imgDest, false);
    imagesavealpha($imgDest, true);
  }
  imagecopyresampled($imgDest, $img, 0, 0, 0, 0, $options['imageSize'][0], $options['imageSize'][0], $options['imageSize'][0] * $options['drawMultiplier'], $options['imageSize'][0] * $options['drawMultiplier']);
  imagedestroy($img);
  return $imgDest;
}
/**
 *  Draws a thick line
 *  Changing the thickness of a line using imagesetthickness doesn't produce as nice of result
 *
 *  @param object $img
 *  @param int $startX
 *  @param int $startY
 *  @param int $endX
 *  @param int $endY
 *  @param object $colour
 *  @param int $thickness
 *
 *  @return void
 */
function drawThickLine ($img, $startX, $startY, $endX, $endY, $colour, $thickness) {
  $angle = (atan2(($startY - $endY), ($endX - $startX)));
  $dist_x = $thickness * (sin($angle));
  $dist_y = $thickness * (cos($angle));
  $p1x = ceil(($startX + $dist_x));
  $p1y = ceil(($startY + $dist_y));
  $p2x = ceil(($endX + $dist_x));
  $p2y = ceil(($endY + $dist_y));
  $p3x = ceil(($endX - $dist_x));
  $p3y = ceil(($endY - $dist_y));
  $p4x = ceil(($startX - $dist_x));
  $p4y = ceil(($startY - $dist_y));
  $array = array(0=>$p1x, $p1y, $p2x, $p2y, $p3x, $p3y, $p4x, $p4y);
  imagefilledpolygon($img, $array, (count($array)/2), $colour);
}

</body></html>

If you are not familier with this. Please see the following...

 

I am using this

 

http://thomasjbradley.ca/lab/signature-pad/

 

I am then trying to make it a png by using this...

 

http://thomasjbradley.ca/lab/signature-to-image/

 

When you go into the first link..

 

Please go into the examples foolder and look at the file called full-window.html

 

That is the one i am trying to use. It does not have a submit button which is weird and I had to add one. But its not working and that is my problem.

 

Link to comment
https://forums.phpfreaks.com/topic/297613-thomas-bradley-sigpad-help/
Share on other sites

this is what I get when I do that.

string(6330) "[{"lx":369,"ly":534,"mx":369,"my":533},{"lx":370,"ly":539,"mx":369,"my":534},{"lx":368,"ly":547,"mx":370,"my":539},{"lx":361,"ly":564,"mx":368,"my":547},{"lx":359,"ly":569,"mx":361,"my":564},{"lx":354,"ly":576,"mx":359,"my":569},{"lx":350,"ly":580,"mx":354,"my":576},{"lx":350,"ly":581,"mx":350,"my":580},{"lx":349,"ly":582,"mx":350,"my":581},{"lx":349,"ly":580,"mx":349,"my":582},{"lx":352,"ly":571,"mx":349,"my":580},{"lx":364,"ly":543,"mx":352,"my":571},{"lx":371,"ly":520,"mx":364,"my":543},{"lx":387,"ly":490,"mx":371,"my":520},{"lx":440,"ly":410,"mx":387,"my":490},{"lx":468,"ly":378,"mx":440,"my":410},{"lx":489,"ly":350,"mx":468,"my":378},{"lx":555,"ly":282,"mx":489,"my":350},{"lx":576,"ly":261,"mx":555,"my":282},{"lx":594,"ly":244,"mx":576,"my":261},{"lx":610,"ly":230,"mx":594,"my":244},{"lx":636,"ly":205,"mx":610,"my":230},{"lx":642,"ly":201,"mx":636,"my":205},{"lx":646,"ly":199,"mx":642,"my":201},{"lx":644,"ly":203,"mx":646,"my":199},{"lx":626,"ly":229,"mx":644,"my":203},{"lx":609,"ly":247,"mx":626,"my":229},{"lx":588,"ly":266,"mx":609,"my":247},{"lx":569,"ly":287,"mx":588,"my":266},{"lx":509,"ly":352,"mx":569,"my":287},{"lx":482,"ly":379,"mx":509,"my":352},{"lx":458,"ly":399,"mx":482,"my":379},{"lx":399,"ly":452,"mx":458,"my":399},{"lx":380,"ly":471,"mx":399,"my":452},{"lx":371,"ly":483,"mx":380,"my":471},{"lx":364,"ly":491,"mx":371,"my":483},{"lx":365,"ly":500,"mx":364,"my":491},{"lx":368,"ly":502,"mx":365,"my":500},{"lx":371,"ly":502,"mx":368,"my":502},{"lx":385,"ly":502,"mx":371,"my":502},{"lx":397,"ly":499,"mx":385,"my":502},{"lx":409,"ly":493,"mx":397,"my":499},{"lx":462,"ly":473,"mx":409,"my":493},{"lx":478,"ly":465,"mx":462,"my":473},{"lx":498,"ly":458,"mx":478,"my":465},{"lx":512,"ly":450,"mx":498,"my":458},{"lx":526,"ly":445,"mx":512,"my":450},{"lx":526,"ly":444,"mx":526,"my":445},{"lx":516,"ly":447,"mx":526,"my":444},{"lx":504,"ly":454,"mx":516,"my":447},{"lx":476,"ly":466,"mx":504,"my":454},{"lx":410,"ly":505,"mx":476,"my":466},{"lx":384,"ly":524,"mx":410,"my":505},{"lx":361,"ly":544,"mx":384,"my":524},{"lx":347,"ly":559,"mx":361,"my":544},{"lx":347,"ly":570,"mx":347,"my":559},{"lx":353,"ly":577,"mx":347,"my":570},{"lx":368,"ly":578,"mx":353,"my":577},{"lx":426,"ly":581,"mx":368,"my":578},{"lx":457,"ly":581,"mx":426,"my":581},{"lx":499,"ly":580,"mx":457,"my":581},{"lx":593,"ly":576,"mx":499,"my":580},{"lx":618,"ly":576,"mx":593,"my":576},{"lx":639,"ly":573,"mx":618,"my":576},{"lx":652,"ly":573,"mx":639,"my":573},{"lx":665,"ly":572,"mx":652,"my":573},{"lx":665,"ly":571,"mx":665,"my":572},{"lx":664,"ly":571,"mx":665,"my":571},{"lx":662,"ly":571,"mx":664,"my":571},{"lx":661,"ly":571,"mx":662,"my":571},{"lx":662,"ly":567,"mx":661,"my":571},{"lx":666,"ly":567,"mx":662,"my":567},{"lx":675,"ly":563,"mx":666,"my":567},{"lx":691,"ly":557,"mx":675,"my":563},{"lx":767,"ly":548,"mx":691,"my":557},{"lx":804,"ly":545,"mx":767,"my":548},{"lx":841,"ly":543,"mx":804,"my":545},{"lx":933,"ly":536,"mx":841,"my":543},{"lx":964,"ly":537,"mx":933,"my":536},{"lx":993,"ly":535,"mx":964,"my":537},{"lx":1039,"ly":525,"mx":993,"my":535},{"lx":1048,"ly":522,"mx":1039,"my":525},{"lx":1056,"ly":520,"mx":1048,"my":522},{"lx":1059,"ly":518,"mx":1056,"my":520},{"lx":1068,"ly":512,"mx":1059,"my":518},{"lx":1069,"ly":509,"mx":1068,"my":512},{"lx":1069,"ly":505,"mx":1069,"my":509},{"lx":1069,"ly":488,"mx":1069,"my":505},{"lx":1071,"ly":482,"mx":1069,"my":488},{"lx":1071,"ly":477,"mx":1071,"my":482},{"lx":1073,"ly":470,"mx":1071,"my":477},{"lx":1076,"ly":456,"mx":1073,"my":470},{"lx":1076,"ly":451,"mx":1076,"my":456},{"lx":1076,"ly":448,"mx":1076,"my":451},{"lx":1076,"ly":439,"mx":1076,"my":448},{"lx":1075,"ly":435,"mx":1076,"my":439},{"lx":1071,"ly":432,"mx":1075,"my":435},{"lx":1055,"ly":415,"mx":1071,"my":432},{"lx":1045,"ly":411,"mx":1055,"my":415},{"lx":1027,"ly":407,"mx":1045,"my":411},{"lx":1007,"ly":401,"mx":1027,"my":407},{"lx":928,"ly":388,"mx":1007,"my":401},{"lx":898,"ly":388,"mx":928,"my":388},{"lx":867,"ly":388,"mx":898,"my":388},{"lx":810,"ly":395,"mx":867,"my":388},{"lx":794,"ly":405,"mx":810,"my":395},{"lx":786,"ly":415,"mx":794,"my":405},{"lx":779,"ly":455,"mx":786,"my":415},{"lx":779,"ly":472,"mx":779,"my":455},{"lx":779,"ly":491,"mx":779,"my":472},{"lx":782,"ly":508,"mx":779,"my":491},{"lx":815,"ly":573,"mx":782,"my":508},{"lx":825,"ly":599,"mx":815,"my":573},{"lx":839,"ly":621,"mx":825,"my":599},{"lx":867,"ly":665,"mx":839,"my":621},{"lx":875,"ly":672,"mx":867,"my":665},{"lx":883,"ly":675,"mx":875,"my":672},{"lx":904,"ly":674,"mx":883,"my":675},{"lx":913,"ly":669,"mx":904,"my":674},{"lx":923,"ly":661,"mx":913,"my":669},{"lx":932,"ly":652,"mx":923,"my":661},{"lx":967,"ly":615,"mx":932,"my":652},{"lx":979,"ly":600,"mx":967,"my":615},{"lx":983,"ly":590,"mx":979,"my":600},{"lx":984,"ly":579,"mx":983,"my":590},{"lx":982,"ly":572,"mx":984,"my":579},{"lx":978,"ly":566,"mx":982,"my":572},{"lx":971,"ly":560,"mx":978,"my":566},{"lx":952,"ly":549,"mx":971,"my":560},{"lx":946,"ly":549,"mx":952,"my":549},{"lx":943,"ly":549,"mx":946,"my":549},{"lx":942,"ly":555,"mx":943,"my":549},{"lx":946,"ly":558,"mx":942,"my":555},{"lx":952,"ly":563,"mx":946,"my":558},{"lx":985,"ly":574,"mx":952,"my":563},{"lx":999,"ly":577,"mx":985,"my":574},{"lx":1014,"ly":579,"mx":999,"my":577},{"lx":1030,"ly":579,"mx":1014,"my":579},{"lx":1072,"ly":579,"mx":1030,"my":579},{"lx":1083,"ly":579,"mx":1072,"my":579},{"lx":1091,"ly":579,"mx":1083,"my":579},{"lx":1101,"ly":577,"mx":1091,"my":579},{"lx":1100,"ly":576,"mx":1101,"my":577},{"lx":1099,"ly":576,"mx":1100,"my":576},{"lx":1098,"ly":576,"mx":1099,"my":576},{"lx":1101,"ly":575,"mx":1098,"my":576},{"lx":1105,"ly":573,"mx":1101,"my":575},{"lx":1116,"ly":570,"mx":1105,"my":573},{"lx":1153,"ly":553,"mx":1116,"my":570},{"lx":1162,"ly":551,"mx":1153,"my":553},{"lx":1175,"ly":547,"mx":1162,"my":551},{"lx":1219,"ly":541,"mx":1175,"my":547},{"lx":1230,"ly":538,"mx":1219,"my":541},{"lx":1239,"ly":538,"mx":1230,"my":538},{"lx":1243,"ly":538,"mx":1239,"my":538},{"lx":1246,"ly":539,"mx":1243,"my":538},{"lx":1246,"ly":540,"mx":1246,"my":539},{"lx":1247,"ly":544,"mx":1246,"my":540},{"lx":1249,"ly":551,"mx":1247,"my":544},{"lx":1251,"ly":554,"mx":1249,"my":551},{"lx":1253,"ly":559,"mx":1251,"my":554},{"lx":1262,"ly":562,"mx":1253,"my":559},{"lx":1271,"ly":563,"mx":1262,"my":562},{"lx":1279,"ly":563,"mx":1271,"my":563}]" array(164) { [0]=> object(stdClass)#1 (4) { ["lx"]=> int(369) ["ly"]=> int(534) ["mx"]=> int(369) ["my"]=> int(533) } [1]=> object(stdClass)#2 (4) { ["lx"]=> int(370) ["ly"]=> int(539) ["mx"]=> int(369) ["my"]=> int(534) } [2]=> object(stdClass)#3 (4) { ["lx"]=> int(368) ["ly"]=> int(547) ["mx"]=> int(370) ["my"]=> int(539) } [3]=> object(stdClass)#4 (4) { ["lx"]=> int(361) ["ly"]=> int(564) ["mx"]=> int(368) ["my"]=> int(547) } [4]=> object(stdClass)#5 (4) { ["lx"]=> int(359) ["ly"]=> int(569) ["mx"]=> int(361) ["my"]=> int(564) } [5]=> object(stdClass)#6 (4) { ["lx"]=> int(354) ["ly"]=> int(576) ["mx"]=> int(359) ["my"]=> int(569) } [6]=> object(stdClass)#7 (4) { ["lx"]=> int(350) ["ly"]=> int(580) ["mx"]=> int(354) ["my"]=> int(576) } [7]=> object(stdClass)#8 (4) { ["lx"]=> int(350) ["ly"]=> int(581) ["mx"]=> int(350) ["my"]=> int(580) } [8]=> object(stdClass)#9 (4) { ["lx"]=> int(349) ["ly"]=> int(582) ["mx"]=> int(350) ["my"]=> int(581) } [9]=> object(stdClass)#10 (4) { ["lx"]=> int(349) ["ly"]=> int(580) ["mx"]=> int(349) ["my"]=> int(582) } [10]=> object(stdClass)#11 (4) { ["lx"]=> int(352) ["ly"]=> int(571) ["mx"]=> int(349) ["my"]=> int(580) } [11]=> object(stdClass)#12 (4) { ["lx"]=> int(364) ["ly"]=> int(543) ["mx"]=> int(352) ["my"]=> int(571) } [12]=> object(stdClass)#13 (4) { ["lx"]=> int(371) ["ly"]=> int(520) ["mx"]=> int(364) ["my"]=> int(543) } [13]=> object(stdClass)#14 (4) { ["lx"]=> int(387) ["ly"]=> int(490) ["mx"]=> int(371) ["my"]=> int(520) } [14]=> object(stdClass)#15 (4) { ["lx"]=> int(440) ["ly"]=> int(410) ["mx"]=> int(387) ["my"]=> int(490) } [15]=> object(stdClass)#16 (4) { ["lx"]=> int(468) ["ly"]=> int(378) ["mx"]=> int(440) ["my"]=> int(410) } [16]=> object(stdClass)#17 (4) { ["lx"]=> int(489) ["ly"]=> int(350) ["mx"]=> int(468) ["my"]=> int(378) } [17]=> object(stdClass)#18 (4) { ["lx"]=> int(555) ["ly"]=> int(282) ["mx"]=> int(489) ["my"]=> int(350) } [18]=> object(stdClass)#19 (4) { ["lx"]=> int(576) ["ly"]=> int(261) ["mx"]=> int(555) ["my"]=> int(282) } [19]=> object(stdClass)#20 (4) { ["lx"]=> int(594) ["ly"]=> int(244) ["mx"]=> int(576) ["my"]=> int(261) } [20]=> object(stdClass)#21 (4) { ["lx"]=> int(610) ["ly"]=> int(230) ["mx"]=> int(594) ["my"]=> int(244) } [21]=> object(stdClass)#22 (4) { ["lx"]=> int(636) ["ly"]=> int(205) ["mx"]=> int(610) ["my"]=> int(230) } [22]=> object(stdClass)#23 (4) { ["lx"]=> int(642) ["ly"]=> int(201) ["mx"]=> int(636) ["my"]=> int(205) } [23]=> object(stdClass)#24 (4) { ["lx"]=> int(646) ["ly"]=> int(199) ["mx"]=> int(642) ["my"]=> int(201) } [24]=> object(stdClass)#25 (4) { ["lx"]=> int(644) ["ly"]=> int(203) ["mx"]=> int(646) ["my"]=> int(199) } [25]=> object(stdClass)#26 (4) { ["lx"]=> int(626) ["ly"]=> int(229) ["mx"]=> int(644) ["my"]=> int(203) } [26]=> object(stdClass)#27 (4) { ["lx"]=> int(609) ["ly"]=> int(247) ["mx"]=> int(626) ["my"]=> int(229) } [27]=> object(stdClass)#28 (4) { ["lx"]=> int(588) ["ly"]=> int(266) ["mx"]=> int(609) ["my"]=> int(247) } [28]=> object(stdClass)#29 (4) { ["lx"]=> int(569) ["ly"]=> int(287) ["mx"]=> int(588) ["my"]=> int(266) } [29]=> object(stdClass)#30 (4) { ["lx"]=> int(509) ["ly"]=> int(352) ["mx"]=> int(569) ["my"]=> int(287) } [30]=> object(stdClass)#31 (4) { ["lx"]=> int(482) ["ly"]=> int(379) ["mx"]=> int(509) ["my"]=> int(352) } [31]=> object(stdClass)#32 (4) { ["lx"]=> int(458) ["ly"]=> int(399) ["mx"]=> int(482) ["my"]=> int(379) } [32]=> object(stdClass)#33 (4) { ["lx"]=> int(399) ["ly"]=> int(452) ["mx"]=> int(458) ["my"]=> int(399) } [33]=> object(stdClass)#34 (4) { ["lx"]=> int(380) ["ly"]=> int(471) ["mx"]=> int(399) ["my"]=> int(452) } [34]=> object(stdClass)#35 (4) { ["lx"]=> int(371) ["ly"]=> int(483) ["mx"]=> int(380) ["my"]=> int(471) } [35]=> object(stdClass)#36 (4) { ["lx"]=> int(364) ["ly"]=> int(491) ["mx"]=> int(371) ["my"]=> int(483) } [36]=> object(stdClass)#37 (4) { ["lx"]=> int(365) ["ly"]=> int(500) ["mx"]=> int(364) ["my"]=> int(491) } [37]=> object(stdClass)#38 (4) { ["lx"]=> int(368) ["ly"]=> int(502) ["mx"]=> int(365) ["my"]=> int(500) } [38]=> object(stdClass)#39 (4) { ["lx"]=> int(371) ["ly"]=> int(502) ["mx"]=> int(368) ["my"]=> int(502) } [39]=> object(stdClass)#40 (4) { ["lx"]=> int(385) ["ly"]=> int(502) ["mx"]=> int(371) ["my"]=> int(502) } [40]=> object(stdClass)#41 (4) { ["lx"]=> int(397) ["ly"]=> int(499) ["mx"]=> int(385) ["my"]=> int(502) } [41]=> object(stdClass)#42 (4) { ["lx"]=> int(409) ["ly"]=> int(493) ["mx"]=> int(397) ["my"]=> int(499) } [42]=> object(stdClass)#43 (4) { ["lx"]=> int(462) ["ly"]=> int(473) ["mx"]=> int(409) ["my"]=> int(493) } [43]=> object(stdClass)#44 (4) { ["lx"]=> int(478) ["ly"]=> int(465) ["mx"]=> int(462) ["my"]=> int(473) } [44]=> object(stdClass)#45 (4) { ["lx"]=> int(498) ["ly"]=> int(458) ["mx"]=> int(478) ["my"]=> int(465) } [45]=> object(stdClass)#46 (4) { ["lx"]=> int(512) ["ly"]=> int(450) ["mx"]=> int(498) ["my"]=> int(458) } [46]=> object(stdClass)#47 (4) { ["lx"]=> int(526) ["ly"]=> int(445) ["mx"]=> int(512) ["my"]=> int(450) } [47]=> object(stdClass)#48 (4) { ["lx"]=> int(526) ["ly"]=> int(444) ["mx"]=> int(526) ["my"]=> int(445) } [48]=> object(stdClass)#49 (4) { ["lx"]=> int(516) ["ly"]=> int(447) ["mx"]=> int(526) ["my"]=> int(444) } [49]=> object(stdClass)#50 (4) { ["lx"]=> int(504) ["ly"]=> int(454) ["mx"]=> int(516) ["my"]=> int(447) } [50]=> object(stdClass)#51 (4) { ["lx"]=> int(476) ["ly"]=> int(466) ["mx"]=> int(504) ["my"]=> int(454) } [51]=> object(stdClass)#52 (4) { ["lx"]=> int(410) ["ly"]=> int(505) ["mx"]=> int(476) ["my"]=> int(466) } [52]=> object(stdClass)#53 (4) { ["lx"]=> int(384) ["ly"]=> int(524) ["mx"]=> int(410) ["my"]=> int(505) } [53]=> object(stdClass)#54 (4) { ["lx"]=> int(361) ["ly"]=> int(544) ["mx"]=> int(384) ["my"]=> int(524) } [54]=> object(stdClass)#55 (4) { ["lx"]=> int(347) ["ly"]=> int(559) ["mx"]=> int(361) ["my"]=> int(544) } [55]=> object(stdClass)#56 (4) { ["lx"]=> int(347) ["ly"]=> int(570) ["mx"]=> int(347) ["my"]=> int(559) } [56]=> object(stdClass)#57 (4) { ["lx"]=> int(353) ["ly"]=> int(577) ["mx"]=> int(347) ["my"]=> int(570) } [57]=> object(stdClass)#58 (4) { ["lx"]=> int(368) ["ly"]=> int(578) ["mx"]=> int(353) ["my"]=> int(577) } [58]=> object(stdClass)#59 (4) { ["lx"]=> int(426) ["ly"]=> int(581) ["mx"]=> int(368) ["my"]=> int(578) } [59]=> object(stdClass)#60 (4) { ["lx"]=> int(457) ["ly"]=> int(581) ["mx"]=> int(426) ["my"]=> int(581) } [60]=> object(stdClass)#61 (4) { ["lx"]=> int(499) ["ly"]=> int(580) ["mx"]=> int(457) ["my"]=> int(581) } [61]=> object(stdClass)#62 (4) { ["lx"]=> int(593) ["ly"]=> int(576) ["mx"]=> int(499) ["my"]=> int(580) } [62]=> object(stdClass)#63 (4) { ["lx"]=> int(618) ["ly"]=> int(576) ["mx"]=> int(593) ["my"]=> int(576) } [63]=> object(stdClass)#64 (4) { ["lx"]=> int(639) ["ly"]=> int(573) ["mx"]=> int(618) ["my"]=> int(576) } [64]=> object(stdClass)#65 (4) { ["lx"]=> int(652) ["ly"]=> int(573) ["mx"]=> int(639) ["my"]=> int(573) } [65]=> object(stdClass)#66 (4) { ["lx"]=> int(665) ["ly"]=> int(572) ["mx"]=> int(652) ["my"]=> int(573) } [66]=> object(stdClass)#67 (4) { ["lx"]=> int(665) ["ly"]=> int(571) ["mx"]=> int(665) ["my"]=> int(572) } [67]=> object(stdClass)#68 (4) { ["lx"]=> int(664) ["ly"]=> int(571) ["mx"]=> int(665) ["my"]=> int(571) } [68]=> object(stdClass)#69 (4) { ["lx"]=> int(662) ["ly"]=> int(571) ["mx"]=> int(664) ["my"]=> int(571) } [69]=> object(stdClass)#70 (4) { ["lx"]=> int(661) ["ly"]=> int(571) ["mx"]=> int(662) ["my"]=> int(571) } [70]=> object(stdClass)#71 (4) { ["lx"]=> int(662) ["ly"]=> int(567) ["mx"]=> int(661) ["my"]=> int(571) } [71]=> object(stdClass)#72 (4) { ["lx"]=> int(666) ["ly"]=> int(567) ["mx"]=> int(662) ["my"]=> int(567) } [72]=> object(stdClass)#73 (4) { ["lx"]=> int(675) ["ly"]=> int(563) ["mx"]=> int(666) ["my"]=> int(567) } [73]=> object(stdClass)#74 (4) { ["lx"]=> int(691) ["ly"]=> int(557) ["mx"]=> int(675) ["my"]=> int(563) } [74]=> object(stdClass)#75 (4) { ["lx"]=> int(767) ["ly"]=> int(548) ["mx"]=> int(691) ["my"]=> int(557) } [75]=> object(stdClass)#76 (4) { ["lx"]=> int(804) ["ly"]=> int(545) ["mx"]=> int(767) ["my"]=> int(548) } [76]=> object(stdClass)#77 (4) { ["lx"]=> int(841) ["ly"]=> int(543) ["mx"]=> int(804) ["my"]=> int(545) } [77]=> object(stdClass)#78 (4) { ["lx"]=> int(933) ["ly"]=> int(536) ["mx"]=> int(841) ["my"]=> int(543) } [78]=> object(stdClass)#79 (4) { ["lx"]=> int(964) ["ly"]=> int(537) ["mx"]=> int(933) ["my"]=> int(536) } [79]=> object(stdClass)#80 (4) { ["lx"]=> int(993) ["ly"]=> int(535) ["mx"]=> int(964) ["my"]=> int(537) } [80]=> object(stdClass)#81 (4) { ["lx"]=> int(1039) ["ly"]=> int(525) ["mx"]=> int(993) ["my"]=> int(535) } [81]=> object(stdClass)#82 (4) { ["lx"]=> int(1048) ["ly"]=> int(522) ["mx"]=> int(1039) ["my"]=> int(525) } [82]=> object(stdClass)#83 (4) { ["lx"]=> int(1056) ["ly"]=> int(520) ["mx"]=> int(1048) ["my"]=> int(522) } [83]=> object(stdClass)#84 (4) { ["lx"]=> int(1059) ["ly"]=> int(518) ["mx"]=> int(1056) ["my"]=> int(520) } [84]=> object(stdClass)#85 (4) { ["lx"]=> int(1068) ["ly"]=> int(512) ["mx"]=> int(1059) ["my"]=> int(518) } [85]=> object(stdClass)#86 (4) { ["lx"]=> int(1069) ["ly"]=> int(509) ["mx"]=> int(1068) ["my"]=> int(512) } [86]=> object(stdClass)#87 (4) { ["lx"]=> int(1069) ["ly"]=> int(505) ["mx"]=> int(1069) ["my"]=> int(509) } [87]=> object(stdClass)#88 (4) { ["lx"]=> int(1069) ["ly"]=> int(488) ["mx"]=> int(1069) ["my"]=> int(505) } [88]=> object(stdClass)#89 (4) { ["lx"]=> int(1071) ["ly"]=> int(482) ["mx"]=> int(1069) ["my"]=> int(488) } [89]=> object(stdClass)#90 (4) { ["lx"]=> int(1071) ["ly"]=> int(477) ["mx"]=> int(1071) ["my"]=> int(482) } [90]=> object(stdClass)#91 (4) { ["lx"]=> int(1073) ["ly"]=> int(470) ["mx"]=> int(1071) ["my"]=> int(477) } [91]=> object(stdClass)#92 (4) { ["lx"]=> int(1076) ["ly"]=> int(456) ["mx"]=> int(1073) ["my"]=> int(470) } [92]=> object(stdClass)#93 (4) { ["lx"]=> int(1076) ["ly"]=> int(451) ["mx"]=> int(1076) ["my"]=> int(456) } [93]=> object(stdClass)#94 (4) { ["lx"]=> int(1076) ["ly"]=> int(448) ["mx"]=> int(1076) ["my"]=> int(451) } [94]=> object(stdClass)#95 (4) { ["lx"]=> int(1076) ["ly"]=> int(439) ["mx"]=> int(1076) ["my"]=> int(448) } [95]=> object(stdClass)#96 (4) { ["lx"]=> int(1075) ["ly"]=> int(435) ["mx"]=> int(1076) ["my"]=> int(439) } [96]=> object(stdClass)#97 (4) { ["lx"]=> int(1071) ["ly"]=> int(432) ["mx"]=> int(1075) ["my"]=> int(435) } [97]=> object(stdClass)#98 (4) { ["lx"]=> int(1055) ["ly"]=> int(415) ["mx"]=> int(1071) ["my"]=> int(432) } [98]=> object(stdClass)#99 (4) { ["lx"]=> int(1045) ["ly"]=> int(411) ["mx"]=> int(1055) ["my"]=> int(415) } [99]=> object(stdClass)#100 (4) { ["lx"]=> int(1027) ["ly"]=> int(407) ["mx"]=> int(1045) ["my"]=> int(411) } [100]=> object(stdClass)#101 (4) { ["lx"]=> int(1007) ["ly"]=> int(401) ["mx"]=> int(1027) ["my"]=> int(407) } [101]=> object(stdClass)#102 (4) { ["lx"]=> int(928) ["ly"]=> int(388) ["mx"]=> int(1007) ["my"]=> int(401) } [102]=> object(stdClass)#103 (4) { ["lx"]=> int(898) ["ly"]=> int(388) ["mx"]=> int(928) ["my"]=> int(388) } [103]=> object(stdClass)#104 (4) { ["lx"]=> int(867) ["ly"]=> int(388) ["mx"]=> int(898) ["my"]=> int(388) } [104]=> object(stdClass)#105 (4) { ["lx"]=> int(810) ["ly"]=> int(395) ["mx"]=> int(867) ["my"]=> int(388) } [105]=> object(stdClass)#106 (4) { ["lx"]=> int(794) ["ly"]=> int(405) ["mx"]=> int(810) ["my"]=> int(395) } [106]=> object(stdClass)#107 (4) { ["lx"]=> int(786) ["ly"]=> int(415) ["mx"]=> int(794) ["my"]=> int(405) } [107]=> object(stdClass)#108 (4) { ["lx"]=> int(779) ["ly"]=> int(455) ["mx"]=> int(786) ["my"]=> int(415) } [108]=> object(stdClass)#109 (4) { ["lx"]=> int(779) ["ly"]=> int(472) ["mx"]=> int(779) ["my"]=> int(455) } [109]=> object(stdClass)#110 (4) { ["lx"]=> int(779) ["ly"]=> int(491) ["mx"]=> int(779) ["my"]=> int(472) } [110]=> object(stdClass)#111 (4) { ["lx"]=> int(782) ["ly"]=> int(508) ["mx"]=> int(779) ["my"]=> int(491) } [111]=> object(stdClass)#112 (4) { ["lx"]=> int(815) ["ly"]=> int(573) ["mx"]=> int(782) ["my"]=> int(508) } [112]=> object(stdClass)#113 (4) { ["lx"]=> int(825) ["ly"]=> int(599) ["mx"]=> int(815) ["my"]=> int(573) } [113]=> object(stdClass)#114 (4) { ["lx"]=> int(839) ["ly"]=> int(621) ["mx"]=> int(825) ["my"]=> int(599) } [114]=> object(stdClass)#115 (4) { ["lx"]=> int(867) ["ly"]=> int(665) ["mx"]=> int(839) ["my"]=> int(621) } [115]=> object(stdClass)#116 (4) { ["lx"]=> int(875) ["ly"]=> int(672) ["mx"]=> int(867) ["my"]=> int(665) } [116]=> object(stdClass)#117 (4) { ["lx"]=> int(883) ["ly"]=> int(675) ["mx"]=> int(875) ["my"]=> int(672) } [117]=> object(stdClass)#118 (4) { ["lx"]=> int(904) ["ly"]=> int(674) ["mx"]=> int(883) ["my"]=> int(675) } [118]=> object(stdClass)#119 (4) { ["lx"]=> int(913) ["ly"]=> int(669) ["mx"]=> int(904) ["my"]=> int(674) } [119]=> object(stdClass)#120 (4) { ["lx"]=> int(923) ["ly"]=> int(661) ["mx"]=> int(913) ["my"]=> int(669) } [120]=> object(stdClass)#121 (4) { ["lx"]=> int(932) ["ly"]=> int(652) ["mx"]=> int(923) ["my"]=> int(661) } [121]=> object(stdClass)#122 (4) { ["lx"]=> int(967) ["ly"]=> int(615) ["mx"]=> int(932) ["my"]=> int(652) } [122]=> object(stdClass)#123 (4) { ["lx"]=> int(979) ["ly"]=> int(600) ["mx"]=> int(967) ["my"]=> int(615) } [123]=> object(stdClass)#124 (4) { ["lx"]=> int(983) ["ly"]=> int(590) ["mx"]=> int(979) ["my"]=> int(600) } [124]=> object(stdClass)#125 (4) { ["lx"]=> int(984) ["ly"]=> int(579) ["mx"]=> int(983) ["my"]=> int(590) } [125]=> object(stdClass)#126 (4) { ["lx"]=> int(982) ["ly"]=> int(572) ["mx"]=> int(984) ["my"]=> int(579) } [126]=> object(stdClass)#127 (4) { ["lx"]=> int(978) ["ly"]=> int(566) ["mx"]=> int(982) ["my"]=> int(572) } [127]=> object(stdClass)#128 (4) { ["lx"]=> int(971) ["ly"]=> int(560) ["mx"]=> int(978) ["my"]=> int(566) } [128]=> object(stdClass)#129 (4) { ["lx"]=> int(952) ["ly"]=> int(549) ["mx"]=> int(971) ["my"]=> int(560) } [129]=> object(stdClass)#130 (4) { ["lx"]=> int(946) ["ly"]=> int(549) ["mx"]=> int(952) ["my"]=> int(549) } [130]=> object(stdClass)#131 (4) { ["lx"]=> int(943) ["ly"]=> int(549) ["mx"]=> int(946) ["my"]=> int(549) } [131]=> object(stdClass)#132 (4) { ["lx"]=> int(942) ["ly"]=> int(555) ["mx"]=> int(943) ["my"]=> int(549) } [132]=> object(stdClass)#133 (4) { ["lx"]=> int(946) ["ly"]=> int(558) ["mx"]=> int(942) ["my"]=> int(555) } [133]=> object(stdClass)#134 (4) { ["lx"]=> int(952) ["ly"]=> int(563) ["mx"]=> int(946) ["my"]=> int(558) } [134]=> object(stdClass)#135 (4) { ["lx"]=> int(985) ["ly"]=> int(574) ["mx"]=> int(952) ["my"]=> int(563) } [135]=> object(stdClass)#136 (4) { ["lx"]=> int(999) ["ly"]=> int(577) ["mx"]=> int(985) ["my"]=> int(574) } [136]=> object(stdClass)#137 (4) { ["lx"]=> int(1014) ["ly"]=> int(579) ["mx"]=> int(999) ["my"]=> int(577) } [137]=> object(stdClass)#138 (4) { ["lx"]=> int(1030) ["ly"]=> int(579) ["mx"]=> int(1014) ["my"]=> int(579) } [138]=> object(stdClass)#139 (4) { ["lx"]=> int(1072) ["ly"]=> int(579) ["mx"]=> int(1030) ["my"]=> int(579) } [139]=> object(stdClass)#140 (4) { ["lx"]=> int(1083) ["ly"]=> int(579) ["mx"]=> int(1072) ["my"]=> int(579) } [140]=> object(stdClass)#141 (4) { ["lx"]=> int(1091) ["ly"]=> int(579) ["mx"]=> int(1083) ["my"]=> int(579) } [141]=> object(stdClass)#142 (4) { ["lx"]=> int(1101) ["ly"]=> int(577) ["mx"]=> int(1091) ["my"]=> int(579) } [142]=> object(stdClass)#143 (4) { ["lx"]=> int(1100) ["ly"]=> int(576) ["mx"]=> int(1101) ["my"]=> int(577) } [143]=> object(stdClass)#144 (4) { ["lx"]=> int(1099) ["ly"]=> int(576) ["mx"]=> int(1100) ["my"]=> int(576) } [144]=> object(stdClass)#145 (4) { ["lx"]=> int(1098) ["ly"]=> int(576) ["mx"]=> int(1099) ["my"]=> int(576) } [145]=> object(stdClass)#146 (4) { ["lx"]=> int(1101) ["ly"]=> int(575) ["mx"]=> int(1098) ["my"]=> int(576) } [146]=> object(stdClass)#147 (4) { ["lx"]=> int(1105) ["ly"]=> int(573) ["mx"]=> int(1101) ["my"]=> int(575) } [147]=> object(stdClass)#148 (4) { ["lx"]=> int(1116) ["ly"]=> int(570) ["mx"]=> int(1105) ["my"]=> int(573) } [148]=> object(stdClass)#149 (4) { ["lx"]=> int(1153) ["ly"]=> int(553) ["mx"]=> int(1116) ["my"]=> int(570) } [149]=> object(stdClass)#150 (4) { ["lx"]=> int(1162) ["ly"]=> int(551) ["mx"]=> int(1153) ["my"]=> int(553) } [150]=> object(stdClass)#151 (4) { ["lx"]=> int(1175) ["ly"]=> int(547) ["mx"]=> int(1162) ["my"]=> int(551) } [151]=> object(stdClass)#152 (4) { ["lx"]=> int(1219) ["ly"]=> int(541) ["mx"]=> int(1175) ["my"]=> int(547) } [152]=> object(stdClass)#153 (4) { ["lx"]=> int(1230) ["ly"]=> int(538) ["mx"]=> int(1219) ["my"]=> int(541) } [153]=> object(stdClass)#154 (4) { ["lx"]=> int(1239) ["ly"]=> int(538) ["mx"]=> int(1230) ["my"]=> int(538) } [154]=> object(stdClass)#155 (4) { ["lx"]=> int(1243) ["ly"]=> int(538) ["mx"]=> int(1239) ["my"]=> int(538) } [155]=> object(stdClass)#156 (4) { ["lx"]=> int(1246) ["ly"]=> int(539) ["mx"]=> int(1243) ["my"]=> int(538) } [156]=> object(stdClass)#157 (4) { ["lx"]=> int(1246) ["ly"]=> int(540) ["mx"]=> int(1246) ["my"]=> int(539) } [157]=> object(stdClass)#158 (4) { ["lx"]=> int(1247) ["ly"]=> int(544) ["mx"]=> int(1246) ["my"]=> int(540) } [158]=> object(stdClass)#159 (4) { ["lx"]=> int(1249) ["ly"]=> int(551) ["mx"]=> int(1247) ["my"]=> int(544) } [159]=> object(stdClass)#160 (4) { ["lx"]=> int(1251) ["ly"]=> int(554) ["mx"]=> int(1249) ["my"]=> int(551) } [160]=> object(stdClass)#161 (4) { ["lx"]=> int(1253) ["ly"]=> int(559) ["mx"]=> int(1251) ["my"]=> int(554) } [161]=> object(stdClass)#162 (4) { ["lx"]=> int(1262) ["ly"]=> int(562) ["mx"]=> int(1253) ["my"]=> int(559) } [162]=> object(stdClass)#163 (4) { ["lx"]=> int(1271) ["ly"]=> int(563) ["mx"]=> int(1262) ["my"]=> int(562) } [163]=> object(stdClass)#164 (4) { ["lx"]=> int(1279) ["ly"]=> int(563) ["mx"]=> int(1271) ["my"]=> int(563) } } 

I don't see an issue with the code. Is there anything in your apache or php logs?

 

With that said, the code:

 

imagepng($img, 'signature.png');
is going to attempt to write the file in the current working directory where that script is running. Your permissions may not be allowing a file to be written there. Try providing the full path to a directory and filename you are sure has write access for the user apache is running as.

 

I'm not much help there because I don't use windows/xamp etc.

 

You should also try and turn off the warning level while debugging this.

 

Try adding:

 

error_reporting(E_ERROR | E_PARSE);
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.