0

Hello,
I need to create a PHP script that reads some of the fields of an RSForn and creates a QR code with them. I've been doing a little bit of research and I've found a PHP library that may suite my needs: http://phpqrcode.sourceforge.net/. Now the question is how do I add this library to my current Joomla installation? Then, forms created with RSForms have a place to enter PHP scripts to be executed when processing forms. So I guess this is my game area. Which is the PHP code to get the value of a given field, let's say, Username? I'll keep researching on the subject, but any suggestion or hint will be highly valued.
Cheers!

Dani

3
Contributors
6
Replies
28
Views
3 Years
Discussion Span
Last Post by diafol
2

You can make the PHP QR code as joomla extension. To be able to do this, you need to follow simple rules as shown here. Pick which example is the closest to your intended application.

0

Hello, its me again. I have some problems making it work. I have copied the whole libraryu to /public_html/libraries/mylib/phpqrcode/qrlib.php. Then, just as a quick set up, I have copied an example (http://phpqrcode.sourceforge.net/examples/index.php?example=025). This is the code:

{source}
<?php
include('../libraries/mylib/phpqrcode/qrlib.php/'); 
include('config.php'); 

// how to build raw content - QRCode with simple Business Card (VCard) 

$tempDir = EXAMPLE_TMP_SERVERPATH; 

// here our data 
$name = 'John Doe'; 
$phone = '(049)012-345-678'; 

// we building raw data 
$codeContents = 'BEGIN:VCARD'."\n"; 
$codeContents .= 'FN:'.$name."\n"; 
$codeContents .= 'TEL;WORK;VOICE:'.$phone."\n"; 
$codeContents .= 'END:VCARD'; 

// generating 
QRcode::png($codeContents, $tempDir.'025.png', QR_ECLEVEL_L, 3); 

// displaying 
echo '<img src="'.EXAMPLE_TMP_URLRELPATH.'025.png" />';

?>
{/source}

I am using sourcerer so that I can run code directly into the HTML module. However, I get this error:

Warning: include(../libraries/mylib/phpqrcode/qrlib.php): failed to open stream: No such file or directory in /home/u909072349/public_html/plugins/system/sourcerer/helper.php(632) : runtime-created function on line 7 Warning: include(../libraries/mylib/phpqrcode/qrlib.php): failed to open stream: No such file or directory in /home/u909072349/public_html/plugins/system/sourcerer/helper.php(632) : runtime-created function on line 7 Warning: include(): Failed opening '../libraries/mylib/phpqrcode/qrlib.php' for inclusion (include_path='.:/usr/lib/php') in /home/u909072349/public_html/plugins/system/sourcerer/helper.php(632) : runtime-created function on line 7 Warning: include(config.php): failed to open stream: No such file or directory in /home/u909072349/public_html/plugins/system/sourcerer/helper.php(632) : runtime-created function on line 8 Warning: include(config.php): failed to open stream: No such file or directory in /home/u909072349/public_html/plugins/system/sourcerer/helper.php(632) : runtime-created function on line 8 Warning: include(): Failed opening 'config.php' for inclusion (include_path='.:/usr/lib/php') in /home/u909072349/public_html/plugins/system/sourcerer/helper.php(632) : runtime-created function on line 8 Fatal error: Class 'QRcode' not found in /home/u909072349/public_html/plugins/system/sourcerer/helper.php(632) : runtime-created function on line 25

Any idea on what's going on? Maybe the gallery is not properly installed?
Thanks!

Dani

Edited by acrocephalus: Wrong data

0

The error messages are telling you that the files that you're referencing do not exist in the location you (or the class) is providing. Check the location of the dirctory against the info you supply in the "include". Also check any further location references in classes used by the include code.

0

Thanks diafol. This is the file qrlib.php

<?php
/*
 * PHP QR Code encoder
 *
 * Root library file, prepares environment and includes dependencies
 *
 * Based on libqrencode C library distributed under LGPL 2.1
 * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi <fukuchi@megaui.net>
 *
 * PHP QR Code is distributed under LGPL 3
 * Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 */

    $QR_BASEDIR = dirname(__FILE__).DIRECTORY_SEPARATOR;

    // Required libs

    include $QR_BASEDIR."qrconst.php";
    include $QR_BASEDIR."qrconfig.php";
    include $QR_BASEDIR."qrtools.php";
    include $QR_BASEDIR."qrspec.php";
    include $QR_BASEDIR."qrimage.php";
    include $QR_BASEDIR."qrinput.php";
    include $QR_BASEDIR."qrbitstream.php";
    include $QR_BASEDIR."qrsplit.php";
    include $QR_BASEDIR."qrrscode.php";
    include $QR_BASEDIR."qrmask.php";
    include $QR_BASEDIR."qrencode.php";

All the libreries included here are in the /public_html/libraries/phpqrcode directory, so I guess this is not the error. Also, the config.php file is on the root (public_html), so this shouldnt' be a problem. Can you provide further help?
Thanks again,

Dani

0

That seems to be an issue:

if config.php is in root (public_html), then the reference to:

include('../libraries/mylib/phpqrcode/qrlib.php/'); 

is wrong, try...

include('libraries/mylib/phpqrcode/qrlib.php/'); 

However, I don't understand how you're getting errors for the other files if they're referenced in the include file and that does not exist at the location stated. Strange.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.