brinley / jSignature

jQuery plugin for adding web signature functionality
http://www.unbolt.net/jSignature
694 stars 529 forks source link

base30的显示问题 #191

Closed czl0325 closed 3 years ago

czl0325 commented 3 years ago

在一个长300高600的div上签字后生成base30,想在一张长30高60的div上显示出base30的签名,但是显示不了,还有要旋转成长60高30来显示。也会出问题。这需求如何实现?

brinley commented 3 years ago

You can display base30 in the jSignature instance. If you want to display in an img, you will need to convert it. There are sample code in the repo examples folder. Alternatively use getData to export in a format that can be displayed in the img tag

czl0325 commented 3 years ago

不是,我在有两个div。第一个div用于签名,并在这个div上签名获取base30图像

$("#signature1").jSignature({color: "#000", width: '300', height: '600', "background-color": "#fff"});
const data = $("#signature1").jSignature('getData', 'base30')

在第二个div显示,div定义如下

$("#signature2").jSignature({color: "#000", width: '30', height: '60', "background-color": "#fff"});
$('#signature2').jSignature('setData', "data:"+ data.join(','))

但是因为#signature2的尺寸是signature1的1/10,无法显示出signature1的图像,你并没有等比缩放10倍填充在signature2内!

czl0325 commented 3 years ago

另外js通过base30转base64可有示例代码?在demo中没有找到。应该怎么调用?能否写个示例

czl0325 commented 3 years ago

@brinley