cURL
curl "https://api.ruseo.cn/api/placeholder?width=200&height=300&id=237&seed=abc&grayscale=1&blur=2"
生成随机占位图片,支持指定尺寸、灰度、模糊等效果,数据来源于Lorem Picsum。
https://api.ruseo.cn/api/placeholder
接口调用前需要确认的核心配置。
/api/placeholderplaceholder必填参数必须传入,示例值可直接用于联调。
免费API不强制要求API Key,但如果您希望统计个人调用次数,请在请求时附加参数 key=您的API_KEY。
注册账号后即可获得API Key。
| 参数名 | 必填 | 类型 | 说明 | 示例值 |
|---|---|---|---|---|
key |
否 | string | 可选参数:携带此参数可统计您的个人调用次数。请注册账号获取API Key。 | YOUR_API_KEY |
width |
是 | integer | 图片宽度(1-5000) | 200 |
height |
否 | integer | 图片高度(可选,默认等于宽度) | 300 |
id |
否 | integer | 指定图片ID | 237 |
seed |
否 | string | 固定随机种子,相同seed返回相同图片 | abc |
grayscale |
否 | boolean | 灰度效果(传1启用) | 1 |
blur |
否 | integer | 模糊程度(1-10) | 2 |
优先使用示例地址测试请求参数是否正确。
https://api.ruseo.cn/api/placeholder?width=200&height=300&id=237&seed=abc&grayscale=1&blur=2
curl "https://api.ruseo.cn/api/placeholder?width=200&height=300&id=237&seed=abc&grayscale=1&blur=2"
$url = 'https://api.ruseo.cn/api/placeholder?width=200&height=300&id=237&seed=abc&grayscale=1&blur=2';
$response = file_get_contents($url);
$data = json_decode($response, true);
fetch('https://api.ruseo.cn/api/placeholder?width=200&height=300&id=237&seed=abc&grayscale=1&blur=2')
.then(res => res.json())
.then(data => console.log(data));
实际返回内容以接口脚本处理结果为准。
{
"code": 0,
"msg": "success",
"data": {
"route": "placeholder",
"example": true
}
}
| 参数名 | 类型 | 说明 | 示例值 |
|---|---|---|---|
image_url |
string | 图片URL | https://picsum.photos/200/300 |
width |
integer | 图片宽度 | 200 |
height |
integer | 图片高度 | 300 |
options |
object | 图片选项 | {"grayscale":true,"blur":2} |
source |
string | 数据来源 | picsum |
点击左侧“发送请求”查看结果...