图像内容审核接口文档

图像内容审核接口文档

ZY沂沨

基础信息

  • 接口地址: https://api.191800.xyz/api/image_review.php
  • 请求方式: GET / POST / OPTIONS
  • 响应格式: JSON
  • 字符编码: UTF-8
  • 支持跨域: 是

功能特性

  1. 支持多种图片输入方式:文件上传、URL下载、Base64编码
  2. 自动检测图片格式和类型
  3. 文件大小和格式验证
  4. 自动上传至腾讯云COS存储
  5. 调用腾讯云内容审核API
  6. 统一的JSON响应格式

支持的图片格式

  • JPEG/JPG
  • PNG
  • GIF
  • WebP
  • BMP

文件大小限制

  • 最大文件大小: 10MB

API接口

审核图片内容

请求方式

1
2
POST /image_review.php
GET /image_review.php?url={图片URL}

请求头

1
2
Content-Type: multipart/form-data  // 文件上传时
Content-Type: application/json // JSON格式时

请求参数

方式一:文件上传(multipart/form-data)
参数名 类型 必填 说明
image file 图片文件
方式二:URL方式(GET/POST)
参数名 类型 必填 说明
urlimage_url string 图片HTTP/HTTPS地址
方式三:Base64编码(JSON/form-data)
参数名 类型 必填 说明
image_base64 string Base64编码的图片数据

响应格式

成功响应
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
{
"success": true,
"code": 200,
"message": "审核成功",
"data": {
"image_url": "https://ci-h5-demo-1258125638.cos.ap-chengdu.myqcloud.com/users/2026017/2026017_zc1TDp4uioQ0.png",
"review_result": {
"AdsInfo": {
"Category": [],
"Code": "0",
"HitFlag": "0",
"Label": [],
"Msg": "OK",
"Score": "0",
"SubLabel": []
},
"Category": [],
"CompressionResult": "0",
"ForbidState": "0",
"JobId": "siab33ba63eb9911f0be87525400b9d9b5",
"Label": "Normal",
"Object": "users/2026017/2026017_zc1TDp4uioQ0.png",
"PoliticsInfo": {
"Category": [],
"Code": "0",
"HitFlag": "0",
"Label": [],
"Msg": "OK",
"Score": "0",
"SubLabel": []
},
"PornInfo": {
"Category": [],
"Code": "0",
"HitFlag": "0",
"Label": [],
"Msg": "OK",
"Score": "19",
"SubLabel": []
},
"Result": "0",
"Score": "0",
"State": "Success",
"SubLabel": [],
"TerroristInfo": {
"Category": [],
"Code": "0",
"HitFlag": "0",
"Label": [],
"Msg": "OK",
"Score": "1",
"SubLabel": []
},
"Text": "你不是在复习吗 怎么学到这来了"
},
"image_info": {
"mime": "image/png",
"ext": "png"
},
"file_size": 618858,
"timestamp": "2026-01-07 15:22:49"
}
}
失败响应
1
2
3
4
5
6
{
"success": false,
"code": 500,
"message": "错误信息",
"data": null
}

HTTP状态码

状态码 说明
200 成功
500 服务器错误

使用示例

示例1:通过URL审核图片(GET)

1
curl -X GET "https://api.191800.xyz/api/image_review.php?url=https://example.com/image.jpg"

示例2:通过URL审核图片(POST JSON)

1
2
3
curl -X POST "https://api.191800.xyz/api/image_review.php" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/image.jpg"}'

示例3:文件上传

1
2
curl -X POST "https://api.191800.xyz/api/image_review.php" \
-F "image=@/path/to/image.jpg"

示例4:Base64编码

1
2
3
curl -X POST "https://api.191800.xyz/api/image_review.php" \
-H "Content-Type: application/json" \
-d '{"image_base64": "base64-encoded-string"}'

示例5:表单方式Base64

1
2
curl -X POST "https://api.191800.xyz/api/image_review.php" \
-d "image_base64=base64-encoded-string"

审核结果说明

审核类型(detect-type)

接口默认检测以下四种类型:

  • porn: 色情内容
  • terrorist: 暴恐内容
  • politics: 政治敏感内容
  • ads: 广告内容

Suggestion字段说明

说明
block 建议屏蔽
pass 建议通过
review 建议人工复核

Score字段说明

  • 取值范围:0-1
  • 数值越高表示置信度越高
  • 通常0.5以上表示有较高可能性

错误码说明

错误类型 可能原因
不支持的图片格式 上传了非支持的图片格式
图片文件过大 文件超过10MB限制
下载图片失败 URL无法访问或网络问题
Base64解码失败 Base64格式不正确
获取上传凭证失败 腾讯云服务异常
上传图片失败 存储服务异常
审核请求失败 审核服务异常

注意事项

安全性

  1. 接口支持跨域请求,生产环境建议限制允许的域名
  2. 上传的图片会存储到腾讯云COS,请确保符合数据隐私要求
  3. 建议在服务器端配置适当的访问控制和频率限制

性能

  1. 大文件处理需要较长时间,建议设置合理的超时时间
  2. 图片尺寸过大会增加审核时间
  3. 建议对图片进行适当的压缩预处理

腾讯云服务

  1. 需要确保腾讯云服务可用
  2. 审核结果格式可能随腾讯云API更新而变化
  3. 注意COS存储的收费情况

开发建议

前端集成

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// 使用Fetch API上传文件
async function uploadImage(file) {
const formData = new FormData();
formData.append('image', file);

const response = await fetch('/image_review.php', {
method: 'POST',
body: formData
});

return await response.json();
}

// 使用URL审核
async function reviewImageByUrl(url) {
const response = await fetch(`/image_review.php?url=${encodeURIComponent(url)}`);
return await response.json();
}

更新日志

v1.0.0

  • 初始版本发布

文档最后更新: 2026年1月7日

  • Title: 图像内容审核接口文档
  • Author: ZY沂沨
  • Created at : 2026-01-07 15:50:03
  • Updated at : 2026-01-07 15:50:03
  • Link: https://blog.191800.xyz/image_review/
  • License: This work is licensed under CC BY-NC-SA 4.0.