主机参考:VPS测评参考推荐/专注分享VPS服务器优惠信息!若您是商家可以在本站进行投稿,查看详情!此外我们还提供软文收录、PayPal代付、广告赞助等服务,查看详情! |
我们发布的部分优惠活动文章可能存在时效性,购买时建议在本站搜索商家名称可查看相关文章充分了解该商家!若非中文页面可使用Edge浏览器同步翻译!PayPal代付/收录合作 |
微信小程序审核被拒。拒绝的原因是用户上传图片可能存在违法问题,程序必须有审核机制。解决方案如下(云开发):config.json
{ 权限 :{ openapi :[ ;security.imgSecCheck ]}}云函数
const cloud = require( # 39;wx-server -SDK # 39;)cloud . init()exports . main = async(event,context)= gt;{ const { value } =事件;请尝试{ const RES = await cloud . open API . security . imgseccheck({ media:{ header:{ # 39;内容-类型 # 39;: '应用程序/octet -流 # 39;},内容类型: # 39;图片/png # 39;,value: Buffer.from(value) } })返回res} catch(err){ return err;}}js
choose image(){ wx . choose image({ count:1,size type:[ # 39;原创 # 39;, '压缩 # 39;],source type:[ # 39;相册 # 39;],成功:(RES)= gt;{ if(RES . temp files[0] ; res.tempFiles[0]。size gt1024 * 1024){ wx . show toast({ title: # 39;图片不能大于1M # 39,图标: # 39;无 # 39;})返回;}//查看图片wx.getfilesystemmanager()。readfile({ file path:RES . tempfile paths[0],success:buffer = >;{ console . log(buffer . data)wx . cloud . call function({ name: # 39;检查 # 39;,数据:{ value: buffer.data } })。然后(imgRes = gt{ if(imgres . result . errcode = = # 39;87014'){ wx . show toast({ title: # 39;图片包含非法内容 # 39;,图标: # 39;无 # 39;}) return} else {//图片正常if (this.data.imgList.length!= 0){ this . setdata({ img list:this . data . img list . concat(RES . tempfile paths)})} else { this . setdata({ img list:RES . tempfile paths })} } },fail:err = gt;{ console . log(err)} })});}、推荐教程:“微信小程序”以上是微信小程序调用图像安全API的详细内容。更多请关注主机参考其他相关文章!
这几篇文章你可能也喜欢:
- 如何检查微信系的无线密码(如何检查微信小程序的WiFi密码)
- 如何获取微信迷你节目的软件包(Android微信小计划)
- 微信小程序无法分享微信时光(为什么微信无分配微信时光?)
- 制定微信迷你计划要花多少钱? 这很昂贵(开发微信迷你计划成本吗?)
- 如何启用微信小程序的付款功能(访问第三方付款给微信小问题)
本文由主机参考刊发,转载请注明:微信小程序调用图片安全API(小程序加载图片) https://zhujicankao.com/76971.html
评论前必须登录!
注册