Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#25 2011-05-01 03:11:31

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,358
Website

Re: smd_qr_code: embed Quick Response barcodes on your site

Hi Stef,

Here’s a funny one. If I use the following:

<txp:smd_qr_code type="custom" layout="BEGIN:VCARD\r\nFN:{name}\r\nEMAIL:{email}\r\nURL:{url}\r\nTEL:{phone}\r\nEND:VCARD" data="My name | me@example.com | www.greatoceanmedia.com.au | 123456789" />

then my QR Code scanner tells me that the END:VCARD line is missing.

But if I shorten the URL, e.g.

<txp:smd_qr_code type="custom" layout="BEGIN:VCARD\r\nFN:{name}\r\nEMAIL:{email}\r\nURL:{url}\r\nTEL:{phone}\r\nEND:VCARD" data="My name | me@example.com | www.greatoceanmedia.com | 123456789" />

then I see the END:VCARD line again.

Very odd … any idea what I’m doing wrong?

Offline

#26 2011-05-01 09:15:29

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,576
Website GitHub

Re: smd_qr_code: embed Quick Response barcodes on your site

Very strange. Using the zxing online decoder and the online barcode reader renders the END:VCARD in both cases.

Can’t think why it would omit it using your decoder but I’d hazard a guess it’s not the plugin but something in the decoder software. I may be wrong here, but is there any way you (or anyone else?) can prove this; perhaps by using a different bit of software to scan the resulting code and see if it does the same thing? I don’t have a hardware scanner so I have to rely on the web for my testing.

Sorry I can’t offer anything more at the moment. Would be good to figure out what’s going on.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#27 2011-05-01 10:20:51

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,358
Website

Re: smd_qr_code: embed Quick Response barcodes on your site

Bloke wrote:

Can’t think why it would omit it using your decoder but I’d hazard a guess it’s not the plugin but something in the decoder software. I may be wrong here, but is there any way you (or anyone else?) can prove this; perhaps by using a different bit of software to scan the resulting code and see if it does the same thing?

Yes, I was hesitant to cast nasturtiums but I’ve just tried a different app on my iPhone (that displays the raw data) & I get the same result. Having said that they all seem to be happy that they can interpret the email address & URL OK, so I wouldn’t worry about it too much.

Here’s the (possibly) offending QR code:

Offline

#28 2011-05-01 19:29:07

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: smd_qr_code: embed Quick Response barcodes on your site

gomedia wrote:

Here’s the (possibly) offending QR code:

Works for me using Android Barcode Scanner.


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#29 2011-11-25 22:03:33

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: smd_qr_code: embed Quick Response barcodes on your site

Hi Stef,

just used this in anger to add qr codes for the organisations and shops on my latest site. I’m using the standard type of ‘text’ (the default setting) and setting ‘data’ to a string representing a vCard I’ve formatted up externally via some PHP. I had to make the following change to smd_qr code get the plugin to handle this case…

--- smd_qr_code-0.31.orig 2011-11-25 21:50:30.000000000 +0000
+++ smd_qr_code-0.31.new 2011-11-25 21:50:30.000000000 +0000
@@ -23,11 +23,11 @@
 		'debug'     => 0,
 	),$atts));

 	// Default layouts
 	$layouts = array(
-		'text'     => "{text}",
+		'text'     => "{data}",
 		'link'     => "{url}",
 		'bookmark' => "MEBKM:TITLE:{title};URL:{url};;",
 		'sms'      => "SMSTO:{phone}:{text}",
 		'phone'    => "TEL:{phone}",
 		'contact'  => "MECARD:N:{name};ADR:{address};TEL:{phone};EMAIL:{email};;",

…as the plugin was complaining about ‘text’ being missing from the attributes. I also have to call smd_qr with validate=“0” or it will also complain about a missing regex for type “text”.

With those two details out of the way all seems well.


Steve

Offline

#30 2011-11-26 20:35:41

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,576
Website GitHub

Re: smd_qr_code: embed Quick Response barcodes on your site

net-carver wrote:

the plugin was complaining about ‘text’ being missing from the attributes.

I can’t remember now why I chose text. It’s probably in the spec. If it’s not and it should be data then I’ll of course change it.

In the meantime if you want to silence the warning you should probably also consider altering the $regexes array a few lines later. The first entry should also be 'data' (and you may have to alter the ‘sms’ layout too since it uses {text}).


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#31 2017-06-07 20:07:28

whocarez
Plugin Author
From: Germany/Ukraine
Registered: 2007-10-08
Posts: 296
Website GitHub Twitter

Re: smd_qr_code: embed Quick Response barcodes on your site

For https sites one should change private $api = 'http://chart.apis.google.com/chart'; to

either

private $api = 'https://chart.apis.google.com/chart';

or

private $api = '//chart.apis.google.com/chart';

Last edited by whocarez (2017-06-07 20:08:19)

Offline

#32 2021-08-18 17:58:20

whocarez
Plugin Author
From: Germany/Ukraine
Registered: 2007-10-08
Posts: 296
Website GitHub Twitter

Re: smd_qr_code: embed Quick Response barcodes on your site

To satisfy Google Pagespeed, which is complaining about "Image elements do not have explicit width and height", one can change:

$content = '<img src="' . $qrc->get_link() . '"'.$tribs.' alt="QR code" />';

to

 $content = '<img src="' . $qrc->get_link() . '"'.$tribs.' alt="QR code" width=".$width." height=".$height." />';

Offline

Board footer

Powered by FluxBB