使用 Coldfusion 创建 QR 码

发布于 2024-10-02 14:51:26 字数 220 浏览 0 评论 0原文

有人获得了“开源二维码库”来与 ColdFusion 一起使用吗?我需要在 ColdFusion 中生成 QR 码。

我还找到了关于如何生成它使用 Zxing

但教程不清楚如何配置文件,例如需要在哪个目录中......

欢迎任何帮助和替代方案,谢谢。

Has anyone gotten the "Open Source QR Code Library" to work with ColdFusion? I need to generate QR Codes in ColdFusion.

I also found this tutorial on how to generate it using Zxing.

But the tutorial is not clear on how to configure the files, e.g. what needs to be in which dir...

Any help and alternatives are welcomed, thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

断念 2024-10-09 14:51:26

Zxing 使用两 (2) 个 jar:core.jarjavase.jar。安装它们的最简单方法是将两个 jar 放在 CF 类路径中的任何位置(例如:C:\ColdFusion8\wwwroot\web-inf\lib)。然后重新启动CF服务器。就是这样。

注意:您可以自己编译 zxing jar,也可以从 blog.getRailo.com) 更新: barcode_samples.zip 文件包含示例 CF 代码。但这仅适用于 Railo。 Adobe CF 不支持 createObject("java") 的额外参数。要在 Adob​​e CF 中使用该代码,您需要删除额外的参数。

<!--- Railo syntax --->
<cfset object = createObject('java','path.to.classtoinvoke','/path/to/jar/file/on/system')>
<!--- Adobe CF --->
<cfset object = createObject('java','path.to.classtoinvoke')>

如果您无权访问类路径,则可以使用 JavaLoader.cfc 加载两个 (2 ) zxing 罐子代替。只需下载该项目即可。它包含一些关于安装和使用的非常好的示例。但如果您还有其他问题,请告诉我。

Zxing uses two (2) jars: core.jar and javase.jar. The easiest way to install them is to place both jars anywhere in the CF classpath (example: C:\ColdFusion8\wwwroot\web-inf\lib). Then restart the CF server. That is it.

Note: You can either compile the zxing jars yourself or download a slightly older version from this handy entry on blog.getRailo.com) Update: The barcode_samples.zip file does contain sample CF code. But it is for Railo only. Adobe CF does not support the extra parameters for createObject("java"). To use the code in Adobe CF, you need to remove the extra parameters.

<!--- Railo syntax --->
<cfset object = createObject('java','path.to.classtoinvoke','/path/to/jar/file/on/system')>
<!--- Adobe CF --->
<cfset object = createObject('java','path.to.classtoinvoke')>

If you do not have access to the classpath, you can use the JavaLoader.cfc to load the two (2) zxing jars instead. Just download the project. It includes some pretty good examples on installation and usage. But if you have further questions, let me know.

对不⑦ 2024-10-09 14:51:26

本质上是对 google API 的封装。

以下是代码的核心:

<cfhttp method="Get" url="http://chart.apis.google.com/chart?chs=150x150&cht=qr&chl=#url.text#" getAsBinary = "yes">

单击此处查看我的博客文章以获取更多详细信息

Essentially wrap the google API.

Here is the core of the code:

<cfhttp method="Get" url="http://chart.apis.google.com/chart?chs=150x150&cht=qr&chl=#url.text#" getAsBinary = "yes">

Click here to see my blog post for further detail

卷耳 2024-10-09 14:51:26

我在我的网站上创建了一个 ColdFusion / jQuery QR 代码生成器。基本上,您只需将要转换的信息以 URL 字符串形式发送给 Google。他们创建并托管图像。

您可以在我的网站上查看它 http://www.EvikJames.com/?StackOverflow在 jQuery 示例部分的“Ajax QR 代码生成器”中,

您可以使用下面的代码来看看我是如何做到的。

$(document).ready(function() {

$("#TextBox").keyup(updateImage);
$("#ImageSize").change(updateImage);

function updateImage() {
    var Message = $(this).attr("value");
    var ImageSize = $("#ImageSize").attr("value");
    $("#ResultImage").animate({ height: ImageSize, width: ImageSize}, 500);
    ImageSize = ImageSize + 'x' + ImageSize;
    MyURL = "https://chart.googleapis.com/chart?chs=" + ImageSize +  "&cht=qr&chl=" + Message;
    $("#ResultImage").attr("src", MyURL);
}

});

I created a ColdFusion / jQuery QR code generator on my web site. Basically, you just send the info you want to convert in a URL string to Google. They create and host the image.

You can check it out on my site at http://www.EvikJames.com/?StackOverflow It's in the jQuery examples section, "Ajax QR Code Generator"

You can use the code below to see how I did it.

$(document).ready(function() {

$("#TextBox").keyup(updateImage);
$("#ImageSize").change(updateImage);

function updateImage() {
    var Message = $(this).attr("value");
    var ImageSize = $("#ImageSize").attr("value");
    $("#ResultImage").animate({ height: ImageSize, width: ImageSize}, 500);
    ImageSize = ImageSize + 'x' + ImageSize;
    MyURL = "https://chart.googleapis.com/chart?chs=" + ImageSize +  "&cht=qr&chl=" + Message;
    $("#ResultImage").attr("src", MyURL);
}

});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文