0

I'd like to use GM in my nodejs application but it seems not working... I get an error message when I try to get the size of my image...

My code :

gm(request.files.file.path)
.size(function (err, size) {
  console.log(err);
});

My error message :

{[Error: spawn ENOENT] code: 'ENOENT', errno: 'ENOENT', syscall: 'spawn'}

My file is well uploaded and when I put request.files.file.path, I have a right path of the file.

EDIT #1:

console.log(request.files.file.path);

// public\uploads\d8fsd5645fsd4fsd4fsd5f4sd65.png

EDIT #2:

enter image description here

tonymx227
  • 5,293
  • 16
  • 48
  • 91
  • can you share the path? and have you tried specifying the full path of your file? – Ravi Sep 22 '14 at 09:47
  • Yes see edit #1 above :) – tonymx227 Sep 22 '14 at 09:52
  • ok, so you're on Windows. Have you tried it with full path to the image, like `C:\nodeapp\public\uploads\d8fsd5645fsd4fsd4fsd5f4sd65.png` ? – Ravi Sep 22 '14 at 09:54
  • No but I get an error message with that, see edit #2 – tonymx227 Sep 22 '14 at 10:01
  • node is `javascript` and they take backward slash as escape character, so you have to replace ` \ ` with ` / ` or you can use ` \\ ` for single backslash, so your path would be like `C:\\users\\abc.....` – Ravi Sep 22 '14 at 10:08
  • No it doesn't work too with '/'... I get the same error message like edit #1... – tonymx227 Sep 22 '14 at 10:23
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/61668/discussion-between-ravi-and-tonymx227). – Ravi Sep 22 '14 at 10:24

0 Answers0