🖼️ 圆形头像生成
上传图片 · 自定义尺寸 · 生成圆形头像(缓存加速)
💡 缓存状态: 缓存文件 0 个 | 总大小 0.0 KB | 有效期 24小时

请求方式:POST

请求地址:https://www.98qy.com/picture/api.php

返回格式:JSON

请求示例:POST /picture/api.php -F "image=@photo.jpg" -F "background=transparent" -F "size=300"

🛠️ 在线生成工具

📤

点击选择图片 或拖拽图片到此

支持 JPG / PNG / GIF · 最大 2MB

📋 请求参数

名称 必填 类型 说明
  image / avatar 是 file 上传的图片文件(支持 JPG / PNG / GIF)
  background 否 string 背景模式:white(白底,默认)或 transparent(透明)
  size 否 int 输出尺寸(50-500px,默认200)

📤 返回参数(JSON)

名称 类型 说明
  code int 状态码(200=成功)
  message string 提示信息
  data.avatar string Base64编码的PNG图片数据
  data.filename string 生成的文件名
  data.url string 图片访问URL(缓存24小时)
  data.background string 背景模式
  data.size int 输出尺寸(px)
  data.expire_hours int 有效期(小时)

📌 请求示例

📤 cURL 调用:
curl -X POST "https://www.98qy.com/picture/api.php" \
  -F "image=@/path/to/photo.jpg" \
  -F "background=transparent" \
  -F "size=300"
📥 返回示例:
{
  "code": 200,
  "message": "success",
  "data": {
    "avatar": "iVBORw0KGgoAAAANSUhEUgAA...",
    "filename": "avatar_6a7ecf9390d5a.png",
    "url": "/cache/picture/avatar_6a7ecf9390d5a.png",
    "background": "transparent",
    "size": 300,
    "expire_hours": 24
  }
}
200 成功 400 请求错误 405 方法不允许 500 服务器错误

🗑️ 缓存管理

清除所有缓存:

https://www.98qy.com/picture/index.php?clear_cache=1&all=1

⚡ 缓存默认保留24小时,过期后自动清理。