简体   繁体   English

如何将画布绘图作为图像保存到文件夹?

[英]How to save canvas drawing as an image to a folder?

Apologies, this question has been asked multiple times, but asking again due to the lack of a suitable answer. 抱歉,这个问题已被问过多次,但由于缺少合适的答案而再次提出。 I need to save a canvas drawing as an image in a folder on my server. 我需要将画布绘图作为图像保存在服务器上的文件夹中。 Can it be done without using AJAX? 无需使用AJAX就能完成吗? The toDataURL method returns the image data as base64 encoded. toDataURL方法返回以base64编码的图像数据。 I need to save it to a folder as an image file. 我需要将其作为图像文件保存到文件夹中。 Is it possible? 可能吗?

Response here How To Save Canvas As An Image With canvas.toDataURL()? 在此处响应如何使用canvas.toDataURL()将画布另存为图像?

or open a new window with data URL: 或使用数据URL打开一个新窗口:

var data = canvas.toDataURL('image/png');
window.open(data);

You just need to right click it ... 您只需要右键单击它即可...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM