我希望将画布保存为 mySql blob 字段中的 blob

发布于 2024-11-25 04:38:33 字数 285 浏览 3 评论 0原文

canvas的toBlob方法似乎对我不起作用,所以我使用了toDataUrl,然后将它生成的数据发送到带有ajax的控制器,然后我将这些数据放入2个字节[]中以将其转换为2个blob但数据从 data:image/png;base64,iVBORw0KGgoAAAANSUhEU... 更改为数字数组 [100, 97, 116, 97, 58, 105, 109, 97, 103, 101, 47, 112, 110...像这样,当回调blob时我想将数字的字节[]更改回原始数据。这可能吗?如果可以的话,请有人给我一些关于如何做到这一点的建议,谢谢

the toBlob method of canvas doesn't seem to work for me, so i have used toDataUrl and then sent the data it produces to a controller with ajax, i've then put this data in2 a byte [] to convert it 2 a blob but the data changes from data:image/png;base64,iVBORw0KGgoAAAANSUhEU.... like so to an array of numbers [100, 97, 116, 97, 58, 105, 109, 97, 103, 101, 47, 112, 110... like so, when calling the blob back i would like to change the byte [] of numbers back to the original data. is this possible and if so could somebody please give me some advise on how to do it, thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

风苍溪 2024-12-02 04:38:33

请参阅我此处写的内容关于此事。为了您的方便,我将其粘贴在下面。简短的回答是 toBlob 太新而无法使用,并且仅仅因为某些内容在规范中并不意味着它已经准备好了。

toBlob() 确实是新的,我不建议在消费者应用程序中使用它,除非您可以明确要求他们使用特定的浏览器(或者控制环境)。

toBlob()5 月添加12th 并且其定义的功能有限。它在 Chrome nightly、firefox nightly 和 IE9 中不存在。

值得注意的是,Firefox 确实有一个功能性的 mozGetAsFile

甚至还没有任何<一href="http://code.google.com/p/chromium/issues/detail?id=83103&q=toblob&colspec=ID%20Stars%20Pri%20Area%20Feature%20Type%20Status%20Summary%20Modified%20Owner %20Mstone%20OS" rel="nofollow noreferrer">将其添加到的讨论Chrome。

针对 Firefox 的讨论。 他们决定等到规范更加明确为止在他们尝试实施之前。

toBlob() 的规范非常模糊,许多内部问题仍未解决。他们甚至还不确定典型的 toBlobl() 使用哪些参数。

Please see what I wrote here on the matter. I'll paste it below for your convenience. The short answer is toBlob is too new to use, and just because something is in the spec doesn't mean its ready.

toBlob() is really new and I would not recommend using it in a consumer app unless you can explicitly ask them to use a particular browser (or else control the environment).

toBlob() Was added on May 12th and is of limited functionality as-defined. It does not exist in the Chrome nightly, firefox nightly, nor IE9.

It is worth noting that Firefox does have a functional mozGetAsFile

There is yet to even be any discussion for adding it to Chrome.

The discussion for Firefox. They have decided to wait until the spec is more clear before they attempt an implementation.

The spec for toBlob() is very vague with a lot of internal questions still unresolved. They aren't even sure what params to allow for typical toBlobl() use yet.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文