使用 JavaScript 生成服务器端图像
是否有任何工具可以让您使用 JavaScript 语言在服务器端生成图像?我正在研究使用相同的 JS 代码在客户端和服务器端渲染图像的可能性。
Are there any tools that allow you to generate images on the server side using JavaScript langauge? I'm investigating the possibility of using the same JS code to render images on the client side and on the server side.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
请参阅此 npm 包 - 它可以执行从验证码到在服务器端调整照片大小的任何操作
https://npmjs.org/package/ canvas
对于客户端...我不知道,但它对于服务器端非常有效。
唯一的缺点是安装相当棘手 - https://github.com/learnboost/node-canvas/wiki
See this npm package - it can do anything from capchas to photo resazing on server sidde
https://npmjs.org/package/canvas
For client side... i do not know, but it works super for serverside.
The only downside is quite tricky installation - https://github.com/learnboost/node-canvas/wiki
让这个问题变得棘手的是你需要一些可以在服务器端和客户端都工作的东西。
如果您愿意将自己限制在 SVG(这意味着您可以告别)旧版本的 MSIE,那么可以根据任何 DOM 进行构建。
What makes this tricky is that you need something that works both server side and client side.
If you are willing to limit yourself to SVG (which means you can kiss goodbye) to older versions of MSIE, then that can be constructed as per any DOM.