【发布时间】:2016-01-29 13:04:44
【问题描述】:
我正在为流星使用 cfs:graphicsmagick 包,我想从 base64 字符串中读取图像。
Meteor.methods({
"readImage"(imgSrc) {
const imageMagick = gm.subClass({ imageMagick: true });
imageMagick(imgSrc)
.write("path/to/image.jpg", (err) => {
if (err) console.log(err);
else console.log("yay!")
});
}
});
但是,当我尝试运行此代码时出现错误:
{ [Error: spawn ENAMETOOLONG] code: 'ENAMETOOLONG', errno: 'ENAMETOOLONG', syscall: 'spawn' }
我尝试通过new Buffer(string, [encoding]) 将字符串转换为缓冲区,但没有成功。
字符串类似这样:data:image/png;base64,iVBORw0K...。
关于如何使它工作的任何建议?
【问题讨论】:
标签: meteor imagemagick graphicsmagick