【发布时间】:2011-10-13 17:32:57
【问题描述】:
我有一个用户可以在浏览器上注释的图像。我可以使用
canvas.toDataURL()
...我想为用户添加一个“保存”选项以将图像保存在服务器上。
这个问题已经回答了php...
file_put_contents('test.png', base64_decode(substr($data, strpos($data, ",")+1)));
...我需要的是带有 PNG 文件内容的 Seaside 回调。
有没有办法在 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()')【问题讨论】:
标签: seaside