问题描述
我是一个使用webgl实现作为我项目的依赖模块的新手.我正在尝试在服务器端使用node-webgl包装器使用.toDataURL()函数.但是我遇到了一个错误站.toDataURL()是未定义的.有关更多详细信息,请查看以下链接:
I am a newbie using webgl implementation as a dependent module for my project. I am trying to use .toDataURL() function using node-webgl wrapper at server side. But I get an error station .toDataURL() is undefined. For more detail, please have a look at this link: canvas.toDataURL() is not a function - error node-webGL wrapper
目前的帖子肯定不是重复的.在帖子中(共享以前的链接),我试图找到一种替代方法来访问canvas的数据.本篇文章的目标是实现.toDataURL()函数.我是这些webgl的新手.您能否分享一些有关如何实现此小功能的链接或过程.还是可以访问浏览器实现的相同功能(在此处复制),在哪里可以得到?
Well the current post is definitely not a duplicate. In the post(earlier link shared) I am trying to find an alternative way to access the data of canvas. The goal of this current post is to implement the .toDataURL() function. I am novice in these webgl. Could you please share some links or procedure on how to implement this small function. or Could I access the same function of browser implementation(copy it here), where can I get that?
任何建议肯定会有所帮助.
Any suggestions will definitely be helpful.
谢谢.
推荐答案
数据URI包括:
data:[<media type>][;base64],<data>
您需要做的就是连接:
- 字符串
"data:"
- 一种媒体类型-例如
"image/jpeg"
- 数据的Base64表示形式
- a string
"data:"
- a media type - e.g.
"image/jpeg"
- Base64 representation of your data
有关更多信息,请参见:
For more info see:
- https://en.wikipedia.org/wiki/Data_URI_scheme
- https://en.wikipedia.org/wiki/Base64
npm
上有几个模块可以帮助您生成Base64:
There are several modules on npm
that can help you generate Base64:
基本上,这是实现toDataURL()
功能所需的所有知识.
This is basically everything that you need to know to implement toDataURL()
function.
这篇关于如何在node.js服务器中实现-toDataURL()函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!