Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

base30显示问题 #192

Open
czl0325 opened this issue Aug 24, 2021 · 7 comments
Open

base30显示问题 #192

czl0325 opened this issue Aug 24, 2021 · 7 comments

Comments

@czl0325
Copy link

czl0325 commented Aug 24, 2021

不是,我在有两个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内!

Originally posted by @czl0325 in #191 (comment)

@czl0325
Copy link
Author

czl0325 commented Aug 24, 2021

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

@brinley
Copy link
Owner

brinley commented Aug 24, 2021

Sorry, theres no sample code to convert between base30 to base64. You might need to look at another library to this. It sounds to me like you are trying to insert a base30 into a canvas that is 1/10 the size of the canvas 1. Have you thought of exporting to svg then instead of loading the signature into canvas 2, just display the svg?

@czl0325
Copy link
Author

czl0325 commented Aug 25, 2021

我也希望导出的是svg,但是后台返回的数据是一串base30的字符,除了用canvas显示,没有其他的办法了。img标签也无法显示base30的图案,而这个base30是在300x600的canvas上绘制生成的,我需要展示的时候缩小到30x60,并且旋转90deg成60*30显示

@brinley
Copy link
Owner

brinley commented Aug 25, 2021

Did you try using
jSignature("getData", "svgbase64")

@czl0325
Copy link
Author

czl0325 commented Aug 26, 2021

我无法使用jSignature("getData", "svgbase64")
后端sql保存的是一串base30的字符串,
前端请求后端是得到一串base30字符串,需要显示出该base30字符串的图案。

@brinley
Copy link
Owner

brinley commented Aug 26, 2021

If you cannot save svgbase64 in your sql db when exporting the signature then you will need to either convert the base30 to another format with a backend process or look at some other libraries to convert.

@czl0325
Copy link
Author

czl0325 commented Aug 26, 2021

后端不同意将base30转换为另一种格式,后端明确要求只保存base30字符串在sql中,并且要求前端展示base30字符串对应的图片。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants