New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to output a new image directly? #127
Comments
If gm(opts.width || 70, opts.height || 30, '#000')
.font("arial", 20)
.stroke("#fff", 2)
.fill("#888")
.drawText(10, 22, text)
.stream(function(err,stdout){
stdout.pipe(res)
}); |
This is ok: gm('./public/static/img/image.png')
.font("arial", 20)
.stroke("#fff", 2)
.fill("#888")
.drawText(10, 22, 'test')
.stream(function(err,stdout){
stdout.pipe(res);
}); But this does not work: gm(opts.width || 70, opts.height || 30, '#000')
.font("arial", 20)
.stroke("#fff", 2)
.fill("#888")
.drawText(10, 22, text)
.stream(function(err,stdout){
stdout.pipe(res)
}); I tried to use gm create a new image and use "write" to save image to disk and this is ok. |
what happens when you do the second one? |
@jonathanong nothing happened.no error occured and no image outputed.Like steam is empty. |
does the response end or does it just hang? |
@jonathanong response is end,and nothing output to browser. |
no issues with gm. created a test for you: https://github.com/aheckmann/gm/blob/master/test/newImage.js. let us know if you can find a reproducible case. no idea what could be going wrong with yoru code, maybe something like content type header. |
I want to use gm to create a captcha and directly output to browser , that means, do not use "write" to output to disk. I tryed this(used gm buffer plugin , express):
but buf.length is 0.
Any suggest?
The text was updated successfully, but these errors were encountered: