如何使用谷歌图表API在QR码中插入图像?

问题描述 投票:0回答:3

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

我现在得到的二维码,

enter image description here

我想要什么二维码,

enter image description here

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

charts google-api qr-code google-developers-console google-developer-tools
3个回答
4
投票

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

您将 QR 有效负载传递到 API 端点并获得图像作为回报:

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

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

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


0
投票

我发现的另一项免费服务这里

https://qrcode.tec-it.com/API/QRCode?data=Helloworld

-1
投票

不幸的是,据我了解,Chart API 没有这样的功能。
但您可以通过使用 CSS 来使用 Image-Overlay。
像这样:

<!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 已被弃用

© www.soinside.com 2019 - 2024. All rights reserved.