I'm trying implement image moderation code to remove adult or violent content as given here: https://github.com/firebase/functions-samples/tree/master/generate-thumbnail
But every time i'm getting this error:
ChildProcessError: Command failed: convert /tmp/test folder/yes.jpg -channel RGBA -blur 0x8 /tmp/test folder/yes.jpg
convert: unable to open image `/tmp/test': No such file or directory @ error/blob.c/OpenBlob/2712.
convert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/501.
convert: unable to open image `folder/yes.jpg': No such file or directory @ error/blob.c/OpenBlob/2712.
convert: unable to open image `/tmp/test': No such file or directory @ error/blob.c/OpenBlob/2712.
convert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/501.
convert: no images defined `folder/yes.jpg' @ error/convert.c/ConvertImageCommand/3210.
`convert /tmp/test folder/yes.jpg -channel RGBA -blur 0x8 /tmp/test folder/yes.jpg` (exited with error code 1)
at callback (/user_code/node_modules/child-process-promise/lib/index.js:33:27)
at ChildProcess.exithandler (child_process.js:213:5)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
due to this line:
// Blur the image using ImageMagick.
return exec(`convert ${tempLocalFile} -channel RGBA -blur 0x8 ${tempLocalFile}`);
And one more help what is best way to moderate video instead of image, i.e. if i want to check if video uploaded is not offensive(adult or violent).
Any help is appreciated.
Thanks fmw42 for help, it was silly mistake. Issue in command is with whitespaces only, try avoiding spaces in folder name. Anyway if you have handle command carefully like:
return exec(`convert "${tempLocalFile}" -channel RGBA -blur 0x8 "${tempLocalFile}"`);