1

I would like to resize some picture before send to user in nodeJs with express

im = require("imagemagick")
app.get('/image/:dossier/:id/:taille', function (req, res) {

    var image = __dirname + '/public/img/bibliotheque/'+req.params.dossier+'/'+req.params.id+'.jpg';
    im.resize({
        srcPath : image,
        width : req.params.taille
    },
    function(err, stdout, stderr) {
        if (err){
            log.error(err);
        } else {
            res.contentType("image/jpeg");
            res.end(stdout);
        }
    });
});

but it's return :

events.js:72
    throw er; // Unhandled 'error' event
          ^
Error: spawn ENOENT
at errnoException (child_process.js:980:11)
at Process.ChildProcess._handle.onexit (child_process.js:771:34)

I try to launch my app with and without sudo but no change
I'm on OSX

Please, help me

Sparks
  • 25
  • 6

1 Answers1

2

You need to install the application in addition to the npm module.

brew install imagemagick
Kenan
  • 3,560
  • 1
  • 18
  • 7