我很难使用graphicmagic从nodejs返回图像。浏览器挂起在流上。
我已经引用了NodeJS gm resize and pipe to response,但是我仍然不能让它工作。
gm = require('gm');
app.get('/text', function (req, res)
{
gm(200, 400, "#ddff99f3")
.drawText(10, 50, "from scratch")
.stream('png', function (err, stdout, stderr) {
stdout.pipe(res);
});
});
发布于 2013-04-08 06:38:12
so...uh,我刚刚重启了我的机器,它神奇地工作了。
发布于 2013-04-08 06:36:27
看起来您没有设置适当的内容类型:
res.set('Content-Type', 'image/png'); // set the header here
在对gm.drawText
的调用之前执行此
https://stackoverflow.com/questions/15868342
复制相似问题