cURL
curl "https://api.ruseo.cn/api/placeholder_image?width=400&height=300&bg=ff6600&color=ffffff&text=Logo&format=json"
生成指定尺寸的占位图片,支持自定义背景色、文字颜色和文字内容,可用于开发测试和原型设计
https://api.ruseo.cn/api/placeholder_image
接口调用前需要确认的核心配置。
/api/placeholder_imageplaceholder_image必填参数必须传入,示例值可直接用于联调。
免费API不强制要求API Key,但如果您希望统计个人调用次数,请在请求时附加参数 key=您的API_KEY。
注册账号后即可获得API Key。
| 参数名 | 必填 | 类型 | 说明 | 示例值 |
|---|---|---|---|---|
key |
否 | string | 可选参数:携带此参数可统计您的个人调用次数。请注册账号获取API Key。 | YOUR_API_KEY |
width |
否 | int | 图片宽度(像素),默认300,范围10-2000 | 400 |
height |
否 | int | 图片高度(像素),默认200,范围10-2000 | 300 |
bg |
否 | string | 背景颜色(十六进制),默认cccccc | ff6600 |
color |
否 | string | 文字颜色(十六进制),默认666666 | ffffff |
text |
否 | string | 显示的文字,默认显示尺寸 | Logo |
format |
否 | string | 返回格式:image(直接输出图片)或json,默认image | json |
优先使用示例地址测试请求参数是否正确。
https://api.ruseo.cn/api/placeholder_image?width=400&height=300&bg=ff6600&color=ffffff&text=Logo&format=json
curl "https://api.ruseo.cn/api/placeholder_image?width=400&height=300&bg=ff6600&color=ffffff&text=Logo&format=json"
$url = 'https://api.ruseo.cn/api/placeholder_image?width=400&height=300&bg=ff6600&color=ffffff&text=Logo&format=json';
$response = file_get_contents($url);
$data = json_decode($response, true);
fetch('https://api.ruseo.cn/api/placeholder_image?width=400&height=300&bg=ff6600&color=ffffff&text=Logo&format=json')
.then(res => res.json())
.then(data => console.log(data));
实际返回内容以接口脚本处理结果为准。
{
"code": 0,
"msg": "success",
"data": {
"route": "placeholder_image",
"example": true
}
}
| 参数名 | 类型 | 说明 | 示例值 |
|---|---|---|---|
width |
int | 图片宽度 | 400 |
height |
int | 图片高度 | 300 |
bg |
string | 背景颜色 | #ff6600 |
color |
string | 文字颜色 | #ffffff |
text |
string | 显示的文字 | Logo |
url |
string | Base64编码的图片数据URI | data:image/png;base64,... |
点击左侧“发送请求”查看结果...