简体   繁体   English

jSignature图片导出到PHP电子邮件

[英]jSignature image export to PHP email

I need help with jSignature. 我需要有关jSignature的帮助。 I am able to create an image and then write that image back into the page. 我能够创建一个图像,然后将该图像写回到页面中。 What I can't get working (and the reason I was exploring this plugin in the first place) is the exporting of the image out of the page. 我无法工作的原因(以及我首先探索此插件的原因)是将图像导出到页面外。 I want to take the image data and send it out in an email so that the image shows up in the body of the email. 我想获取图像数据并通过电子邮件发送出去,以便图像显示在电子邮件正文中。 If have tried a lot of approaches and nothing has worked. 如果尝试了很多方法而没有任何效果。 Currently my js looks like this: 目前,我的js如下所示:

var $sigDiv = $("#signature").jSignature();
      $('<input type="button" value="Reset">').bind('click', function(e){
        $sigDiv.jSignature('reset');
      }).appendTo($sigDiv);

And upon submit of the form it looks like this: 提交表单后,它看起来像这样:

var datapair = $sigDiv.jSignature("getData", "svg");
      var i = new Image();
      i.src = "data:" + datapair[0] + "," + datapair[1];
      $(i).appendTo($("#success"));

I try to grab that image data in a variable and through AJAX send it in a data string to a PHP mail processing form doing something like this: 我尝试将图像数据捕获到一个变量中,然后通过AJAX将其以数据字符串形式发送到PHP邮件处理表单,如下所示:

<img src="<?php echo $_POST['signature']; ?>"/>

Or this: 或这个:

<object src="<?php echo $_POST['signature']; ?>"></object>

I've exhausted myself on trying to get this to display an image in the email that goes out. 我已经精疲力尽了,试图使它显示在出去的电子邮件中的图像。 Any help is much appreciated. 任何帮助深表感谢。

YEHESSS! 没错! Got it to work. 得到它的工作。 If I export as an image and do encodeURIComponent(image) on the image the AJAX call doesn't screw up the image data. 如果我导出为图像,并在图像上进行encodingURIComponent(image),则AJAX调用不会破坏图像数据。 Works like a BEAST now. 现在像BEAST一样工作。 Hey thanks for your help Abid. 谢谢您的帮助,阿比德。

i am not sure but you see below url i think it is help full to you 我不确定,但是您看到下面的网址,我认为这对您有帮助

https://github.com/brinley/jSignature/ https://github.com/brinley/jSignature/

demo url ;- 演示网址;-

http://willowsystems.github.com/jSignature/#/demo/ http://willowsystems.github.com/jSignature/#/demo/

jSignature is a jQuery plugin which simplifies creation of a signature capture field in the browser window, allowing a user to draw a signature using mouse, pen, or finger. jSignature是一个jQuery插件,它简化了浏览器窗口中签名捕获字段的创建,允许用户使用鼠标,钢笔或手指绘制签名。

jSignature captures signature as vector outlines of the strokes. jSignature将签名捕获为笔划的矢量轮廓。 Although jSignature can export great bitmap (PNG) too, extraction of highly scalable stroke movement coordinates (aka vector image) of the signature allows much greater flexibility of signature rendering. 尽管jSignature也可以导出伟大的位图(PNG),但是提取签名的高度可缩放笔画运动坐标(也称为矢量图像)可以使签名渲染具有更大的灵活性。

A extra effort (through smoothing and pressure simulation) is made to make the strokes look pretty on the screen while these are drawn by the signor. 做出额外的努力(通过平滑和压力模拟),以使笔画在签名者绘制的同时在屏幕上看起来更漂亮。

All major desktop, tablet and phone browsers are supported. 支持所有主要的台式机,平板电脑和电话浏览器。 HTML5 Canvas element is used by default. 默认情况下使用HTML5 Canvas元素。 We fall back on Flash-based Canvas element emulator (FlashCanvas) when actual Canvas is not supported by the browser (Iinternet Explorer v.8 and lower). 当浏览器不支持实际的Canvas(Inetnet Explorer v.8及更低版本)时,我们将使用基于Flash的Canvas元素仿真器(FlashCanvas)。

Real-time jSignature renders only the device-appropriate "prettiest" approximation of what we capture. 实时jSignature仅呈现与设备匹配的“最原始”近似值。 Capture of data is always same - we capture as many movement coordinates as possible. 数据捕获总是相同的-我们捕获尽可能多的运动坐标。 Rendering of strokes differs per browser's capabilities, efficiency of the device, screen size. 笔划的呈现因浏览器的功能,设备的效率和屏幕尺寸而异。

This degrading and enhancing of screen representation of the captured signature is done on purpose to insure that rendering does not impead on the responsiveness of capture. 对捕获的签名的屏幕表示的这种降级和增强是有意完成的,以确保渲染不会影响捕获的响应能力。 For example, on slow rendering devices (Android Browser, FlashCanvas-based Canvas emulation) smoothing is kicked up a notch to compensate for large gaps in captured stroke coordinates - a result of inefficiency of capture device. 例如,在渲染速度较慢的设备(Android浏览器,基于FlashCanvas的Canvas仿真)上,平滑处理会出现一个缺口,以补偿捕获的笔划坐标中的较大间隙(捕获设备效率低下的结果)。 In all cases, customer shold be pleased by responsiveness and beauty of the drawing. 在任何情况下,客户的意见都对图纸的响应能力和美观程度感到满意。

jSignature makes it easy to pluck itself into an existing styled site. 使用jSignature可以很容易地将自己插入到现有样式的站点中。 jSignature automatically detects the colors used on the wrapping element (text color = pen color, background = background) and auto-picks a pleasing middle-shade for 'decor' (signature line). jSignature会自动检测包装元素上使用的颜色(文本颜色=笔颜色,背景=背景),并自动为“装饰”(签名行)选择一个令人满意的中间阴影。 jSignature adapts well to fixed and variable width web page designs, and various size screens (phones, tablets, computer screens) and automatically rescales the drawing area and signature when parent element changes size jSignature非常适合固定宽度和可变宽度的网页设计以及各种大小的屏幕(电话,平板电脑,计算机屏幕),并且在父元素更改大小时自动重新缩放绘图区域和签名

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM