Domanda

I have a composite image code like this:

// This method overlays the watermark on the source and save it as destination!
function compositeImage(source, watermark, destination, callback)
{
    var spawn = require('child_process').spawn;
    var composite = spawn('gm',
      [
          'composite',
          '-dissolve',
          '100', //溶解度,和透明度类似
          watermark,
          source,
          destination
      ]);

    composite.stdout.on('data',function(data){
      console.log(data);
    });

    composite.stderr.on('data',function(data){
      console.log(data);
    });

    composite.on('exit',function(code){
      if(code != 0){
          console.log('gm composite process exited with code ' + code);
      }
      callback();
    });
}

It works locally on my mac, but when I try to run this method on Heroku, I will get an error like this:

UNCAUGHT ERROR: Error: spawn ENOENT
2013-12-19T15:27:17.708684+00:00 app[web.1]:     at errnoException (child_process.js:980:11)
2013-12-19T15:27:17.708684+00:00 app[web.1]:     at Process.ChildProcess._hand
È stato utile?

Soluzione

You don't have gm installed on Heroku.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top