如何使用谷歌图表api在二维码中插入图像



我正在使用谷歌图表api生成二维码,如何在图像中插入图像。

我现在得到的二维码,

在此处输入图像描述

我想要什么二维码,

在此处输入图像描述

有人能帮我解决这个问题吗。

警告:此API已弃用。请改用积极维护的Google图表API。有关的详细信息,请参阅我们的折旧政策

您将QR有效载荷传递到API端点,并得到一个图像作为回报:

https://quickchart.io/qr?text=Hello世界

另一种选择是图像图表(高度可靠,部署在世界各地的数据中心,响应时间不到秒(

https://documentation.image-charts.com/qr-codes/

不幸的是,据我所知,Chart API没有这样的函数
但是您可以使用CSS来使用图像覆盖
像这样:

<!DOCTYPE html>
<html>
<head>
<base target="_top">
<style>
.qrcode
{
position: relative;
top: 0;
left: 0;
width: 200px;
height: 200px;
}
.shell
{
position: absolute;
top: 80px;
left: 80px;
width: 40px;
height: 40px;
}
</style>

</head>
<body>
<div style="position: relative; left: 0; top: 0;">
<img class="qrcode" src="https://chart.googleapis.com/chart?chs=150x150&amp;cht=qr&amp;chl=Hello%20world&amp;choe=UTF-8" alt="QR code" />
<img class="shell" src="YOUR IMAGE'S URL" />
</div>  
</body>
</html>

你可以在这里看到我的示例页。

不过,请注意Chart的QRcode API已经被弃用。

最新更新