我有一个用户可以在浏览器上注释的图像。我可以使用访问图像
canvas.toDataURL()
...我想为用户添加一个“保存”选项以将图像保存在服务器上。
这个问题已经回答了php ...
file_put_contents('test.png', base64_decode(substr($data, strpos($data, ",")+1)));
...我需要的是带有 PNG 文件内容的 Seaside 回调。
有没有办法在海边做到这一点?
Johan 指出地雷类型声明必须从值字符串中删除。这适用于大众...(使用字符串破解删除'data:image / png;base64,')
html jQuery ajax 回调:[:值| | 写流字符串 | writestream := ('c:\data\sketchpad_image.png' asFilename withEncoding: #binary) writeStream. string := value copyFrom: 23 to: 值大小。 [writestream nextPutAll: (Seaside.GRPlatform current base64Decode: string) asByteArray] 确保:[writestream close] ] 值:(Javascript.JSStream on:'sketchpadCanvas.toDataURL()')