/api/ImageHosting/scdn/upload
累计调用 0 次
上传图片
上传一张图片,返回可直接引用的 CDN 外链。
本地图片文件(multipart 字段 image,支持 jpg/png/webp/gif/bmp/tiff);与 image_url 二选一
远程图片地址(http/https),服务端代理拉取;与 image 二选一
选填:输出格式,默认 auto
选填:指定外链 CDN 域名(如 img.scdn.io),留空自动选择
选填:存储位置
选填:加密上传(加密图永不参与秒传)
选填:password_enabled=true 时必填
选填:密码模式,默认 plain
选填:password_type=qa 时必填
- 请求体为 multipart/form-data(文件字段 image,可直接用下方“选择文件”上传);用 image_url 时也可用 application/x-www-form-urlencoded。
- 服务端按 SHA-256 秒传:命中时 message 为「图片已存在,秒传成功!」,deduped=true。
- 本服务需项目签名(app_id/timestamp/nonce/sign);在线调试由服务端自动代签。
| 字段 | 类型 | 说明 |
|---|---|---|
| url | string | CDN 外链地址 |
| filename | string | 文件名 |
| storage_backend | string | 存储后端 |
| original_size | int | 原始大小(字节) |
| compressed_size | int | 压缩后大小(字节) |
| compression_ratio | float | 压缩率 |
| deduped | bool | 是否命中秒传 |
| password_protected | bool | 是否加密保护 |
{"url": "https://img.scdn.io/xxxx.jpg", "filename": "xxxx.jpg", "storage_backend": "local", "original_size": 123456, "compressed_size": 98765, "compression_ratio": 80.01, "deduped": false, "password_protected": false}