服务接口

请求地址

https://lc.nlrdev.top/meme/backend/image

请求方式

GET

请求参数

参数名可选值说明
source nlr:反向代理 NLR 有梗服务接口
linkium:联创自托管图库,默认值
其他参数仅在 source=linkium 时生效
format json:返回 JSON 数据
image:返回图片,默认值

Image 说明

format=imageformat 留空时,服务端会直接返回一张 JPEG 格式的图片。 接口调用示例:
<img src="https://lc.nlrdev.top/meme/backend/image">

JSON 说明

format=json 时,服务端会向您返回图片的长宽信息和图片的 DataURL。 返回数据示例:
{
	"url": "data:image\/jpeg;base64,<一串Base64>",
	"width": 1145,
	"height": 1919
}
接口调用示例:
<img id="memeImg">
<div id="memeText"></div>

<script>
	const img = document.getElementById("memeImg");
	const text = document.getElementById("memeText");

	fetch("https://lc.nlrdev.top/meme/backend/image?format=json")
	.then(res => { return res.json(); })
	.then(json => {
		img.src = json.url;
		text.innerText = `宽度:${json.width}px;高度:${json.height}px`;
	});
</script>