在电子邮件中显示签名图像

时间:2016-09-17 13:01:26

标签: php jquery html5

我正在寻找签名板并且遇到了Thomas Bradley的插件。 我正在尝试将签名显示为电子邮件中的图像。我得到的只是一个图像代码

客户签名:

[{ “LX”:69 “LY”:44, “MX”:69, “我的”:43},{ “LX”:68, “LY”:43, “MX”:69,”我的 “:44},{” LX “:68,” LY “:44,” MX “:68,” 我的 “:43},{” LX “:69”,LY “:48,” MX“:68 , “我的”:44},{ “LX”:72, “LY”:55, “MX”:69, “我的”:48},{ “LX”:77, “LY”:67, “MX” :72, “我的”:55},{ “LX”:85, “LY”:82, “MX”:77, “我的”:67},{ “LX”:90 “LY”:96,” MX “:85,” 我的 “:82},{” LX “:93,” LY “:107,” MX “:90,” 我的 “:96},{” LX “:95”,LY“:114 , “MX”:93, “我的”:107},{ “LX”:97 “LY”:117, “MX”:95, “我的”:114},{ “LX”:98, “LY” :117, “MX”:97, “我的”:117},{ “LX”:102, “LY”:113, “MX”:98, “我的”:117},{ “LX”:110,” LY “:102,” MX “:102,” 我的 “:113},{” LX “:120,” LY “:86,” MX “:110,” 我的 “:102},{” LX“:131 “LY”:68, “MX”:120, “我的”:86},{ “LX”:139, “LY”:53, “MX”:131, “我的”:68},{ “LX” :143, “LY”:48, “MX”:139, “我的”:53},{ “LX”:145, “LY”:47, “MX”:143, “我的”:48},{” LX “:147,” LY “:49,” MX “:145,” 我的 “:47},{” LX “:154,” LY “:55,” MX “:147,” 我的“:49}, { “LX”:159, “LY”:62, “MX”:154, “我的”:55},{ “LX”:161, “LY”:68, “MX”:159, “我的”:62 },{ “LX”:162, “LY”:73, “MX”:161, “我的”:68},{ “LX”:162, “LY”:75, “MX”:162, “我” 的:73},{ “LX”:162, “LY”:74, “MX”:162, “我的”:75},{ “LX”:166, “LY”:66, “MX”:162,”我的 “:74},{” LX “:173,” 立法院”      :53, “MX”:166, “我的”:66},{ “LX”:180, “LY”:37, “MX”:173, “我的”:53},{ “LX”:182,” LY “:27,” MX “:180,” 我的 “:37},{” LX “:182,” LY “:23,” MX “:182,” 我的 “:27},{” LX“:178 “立法院”:31, “MX”:182, “我”:23},{ “LX”:169, “立法院”:45, “MX”:178, “我”:31},{ “LX” :163, “LY”:59, “MX”:169, “我的”:45},{ “LX”:161, “LY”:66, “MX”:163, “我的”:59},{” LX “:163,” LY “:68,” MX “:161,” 我的 “:66},{” LX “:170,” LY “:64,” MX “:163,” 我的“:68}, { “LX”:183, “LY”:55, “MX”:170, “我的”:64},{ “LX”:205, “LY”:43, “MX”:183, “我的”:55 },{ “LX”:230, “LY”:32, “MX”:205, “我的”:43},{ “LX”:267, “LY”:22, “MX”:230, “我” 的:32},{ “LX”:300, “LY”:12, “MX”:267, “我的”:22},{ “LX”:307, “LY”:9, “MX”:300,”我的“:12},{”lx“:308,”ly“:8,”mx“:307,”我的“:9}]

PHP代码:

    <?php 
require_once("session.php");

  require_once("class.user.php");
  $auth_user = new USER();

  $user_id = $_SESSION['user_session'];

  $stmt = $auth_user->runQuery("SELECT * FROM users WHERE user_id=:user_id");
  $stmt->execute(array(":user_id"=>$user_id));

  $userRow=$stmt->fetch(PDO::FETCH_ASSOC);

if ($_POST['submit']) {

    if (!$_POST['output']) {
      $error = "<br>- Please enter your signature!";
    }

  if ($error) {
    $result = "<div class='alert alert-danger' role='alert'>Whoops, there is an error. Please correct the following: $error</div>";
  } else {
    mail("albetws@gmail.com", "Request form", "From: ".$_POST['username']."

      Message: ".$_POST['message']."

      Client signature: ".$_POST['output']);

    {
      $result = "<div class='alert alert-success text-center' role='alert'>
      <p>Thank you for your request.</p>
      <p>No request conformation within 1 hr call the receiver</p>
      <p>Please <a href='logout.php?logout=true'>Logout</a>.</p>
      </div>";
    }
  }

}

 ?>

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <title>Title</title>

    <!-- Bootstrap -->
    <link href="signature/assets/jquery.signaturepad.css" rel="stylesheet">
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="css/style.css">
    <!--[if lt IE 9]><script src="../assets/flashcanvas.js"></script><![endif]-->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
    <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
    <script src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"></script>
</head>

<body>

    <section>
        <div class="container">
            <div class="row">
                <div class="col-xs-12 col-sm-4 col-sm-offset-4">
                    <h2 class="text-center">Client Approval</h2>
                    <p class="text-center"><a href="option.php">Return to Main Menu </a>&nbsp;&sol;&nbsp; <a href="logout.php?logout=true">Logout</a></p>
                    <?php echo $result;?>
                        <form action="" method="post" role="form" class="sigPad">

                            <p class="drawItDesc">Insert signature in the box below.</p>
                            <div class="sig sigWrapper">
                                <canvas class="pad" height="150"></canvas>
                                <input type="hidden" name="output" class="output">
                            </div>

                            <div class="form-group input-group btn-margin">
                                <span class="input-group-addon">
                  <span class="glyphicon glyphicon-remove"></span>
                                </span>
                                <input type="button" name="clear" class="form-control btn btn-primary clearButton" value="Clear signature">
                            </div>

                            <div class="form-group input-group btn-margin">
                                <span class="input-group-addon">
                  <span class="glyphicon glyphicon-send"></span>
                                </span>
                                <input type="submit" name="submit" class="form-control btn btn-primary" value="Submit signature">
                            </div>

                        </form>
                </div>
            </div>
        </div>
    </section>

    <script src="signature/jquery.signaturepad.js"></script>
    <script>
        $(document).ready(function() {

            var options = {
                defaultAction: 'drawIt',
                drawOnly: true,
                lineTop: 135,
                lineMargin: 20,
                penColour: '#000'
            }

            $('.sigPad').signaturePad(options);
        });
    </script>
    <script src="signature/assets/json2.min.js"></script>

    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="js/bootstrap.min.js"></script>
</body>

</html>

谢谢

1 个答案:

答案 0 :(得分:-2)

我在github.com网站的麻省理工学院许可下使用了szimek pad签名。 否则,我不会在您的代码中看到您保存图像的格式。