check the err object in your callback for im and check the third param 
which is stderr. if stdout is null then probably an error is occurred 

Am Dienstag, 12. Februar 2013 09:46:02 UTC+1 schrieb Rakesh Kumar:
>
> I am using image urls in my nodejs server directly to fetch images. what i 
> want is to create thumbnails of the images and show it in the browser. The 
> problem i am facing is with imagemagick. stdout is showing null values. How 
> to get data of resized image?
> Below is the code i am implementing. urls are defined in an global array.
>
> http.createServer(function(req,res){
> var i=1;
> var buf='';
> request({url:url[i], encoding: null}, function (err, response, body) {
> if (!err && response.statusCode == 200) {
> im.resize({
> srcData: body,
> width: 50,
> }, function(err, stdout) {
> res.writeHead(200,{"Content-type":"text/html"});
> res.write(stdout.toString('base64'));
> res.write('<img src = "data:image/png;base64,' + stdout.toString('base64') 
>   );
> res.end('" />');
> });
> }
> });
> }).listen(1337,'127.0.0.1');
>

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to