用于图像审核Firebase函数的ChildProcessError [英] ChildProcessError for image moderation firebase function

查看:75
本文介绍了用于图像审核Firebase函数的ChildProcessError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试实施图像审核代码,以删除此处提供的成人或暴力内容: https://github.com/firebase/functions-samples/tree/master/generate-thumbnail

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)

由于此行:

// 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).

感谢您的帮助.

推荐答案

感谢fmw42的帮助,这是一个愚蠢的错误.命令中的问题仅包含空格,请尝试避免文件夹名称中包含空格.无论如何,如果您有认真的处理命令,例如:

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}"`);

这篇关于用于图像审核Firebase函数的ChildProcessError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆