Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: smd_qr_code: embed Quick Response barcodes on your site
I’d be suprised if the browser wasn’t cacheing it at least for those 24 hours.
Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker
Offline
Re: smd_qr_code: embed Quick Response barcodes on your site
MattD wrote:
I’d be suprised if the browser wasn’t cacheing it at least for those 24 hours.
Confirmed. The browser saves the day, yay! Internet biscuits all round. I’ve added a few more features to the plugin. Final testing in progress. Should be out later today when I get a chance to tart up the docs.
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
Online
Re: smd_qr_code: embed Quick Response barcodes on your site
v0.20 released.
Features:
- added
title
attribute for the<img>
tag (when usingformat="view"
and nowraptag
) - added
validate
attribute to allow custom validation by regex (overrides the built-in regexes) - added
validelim
anddebug
attributes to suportvalidate
- added limited vcard type (thanks gomedia). Just name, email, web site, address and phone number supported. Please test!
- improved error reporting and documentation
- fixed URL regex
If you want to be more restrictive in your regexes (some of the defaults are just “any character”) then you can now do custom validation on selected fields. Please remember that the regex you supply must be a complete regex string including start and end delimiters, e.g. /[0-9A-Za-z. \-]/
. If you omit the surrounding delimiters things will probably go wrong.
See how you get on with this one and let me know.
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
Online
#16 2011-04-02 23:40:30
- gomedia
- Plugin Author
- Registered: 2008-06-01
- Posts: 1,373
Re: smd_qr_code: embed Quick Response barcodes on your site
Bloke wrote:
added limited vcard type (thanks gomedia). Just name, email, web site, address and phone number supported. Please test!
Thanks Stef. It seems to work OK, although I note that “http://” has to be used on the URL and that a data value can’t be omitted (for example, I don’t give anyone my address).
Rather than forcing fixed data types and positions – data = "name | email | url | address | phone"
– would something like:
data = 'FN="abc", EMAIL="me@abc.com", URL="www.abc.com"'
be a bit more flexible for the user and easier for you to maintain?
Offline
#17 2011-04-03 01:37:18
- gomedia
- Plugin Author
- Registered: 2008-06-01
- Posts: 1,373
Re: smd_qr_code: embed Quick Response barcodes on your site
or if type="text"
recognised the delimiter and generated new lines in the output:
type="text" data="BEGIN:VCARD | FN:My Business Name | TEL:01234 123456 | URL:www.mybusinessname.com.au | EMAIL:nobody@mybusinessname.com.au | END:VCARD"
… unfortunately couldn’t get “\r\n” to work as a delimiter!
Offline
Re: smd_qr_code: embed Quick Response barcodes on your site
gomedia wrote:
I note that “http://” has to be used on the URL
That’s just the built-in regex at work. You could override that for the time being until I can figure out a better system.
and that a data value can’t be omitted (for example, I don’t give anyone my address).
Yeah, that kind of annoyed me that I couldn’t actually remove the ADR from the output, even though you could specify {smd_empty}
to state that you didn’t want to provide it. Your suggestion of allowing someone to specify the fields is interesting. I’d been racking my brain to find a better way to handle it so you could a) decide what data went into the code, and b) define your own codes. Haven’t found a neat system yet.
One solution is an admin interface that has all the current codes loaded into it and allows you to edit/delete them and/or add new ones. A bit like the way smd_macro works. But that seemed very expensive in terms of code for something that might not be used that often so perhaps an ‘inline’ mechanism to specify a layout in the tag might be useful. The problem there is it gets very clunky very quickly, especially as you found when trying to set delimiters to \r\n. A hidden pref is another way, but again it’d be nice to be able to configure it graphically.
I’ll have a play with some ideas. If anybody has any others to throw into the mix I’ll check them out while I’m at it. Gotta be a way to make this a generic QR code plugin somehow. I’m a bit hamstrung by the Charts API interface I robbed off the Internet at the moment. After having played with it for some time I realised it really is a bit limiting compared with what can be done directly with the API, so perhaps dropping the interface and writing my own generic one that hooks directly into the Charts API might be a simpler way forward. Heck that might even pave the way for smd_charts… :-)
Will see.
Last edited by Bloke (2011-04-03 13:58:03)
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
Online
Re: smd_qr_code: embed Quick Response barcodes on your site
Hey Stef – great plugin, margin doesn’t seem to be working, always stays at the default of 4…
Offline
Re: smd_qr_code: embed Quick Response barcodes on your site
Heck that might even pave the way for smd_charts… :-)
Genericized charting in TXP would be awesome! I would totally find a nail to hit with that hammer.
Offline
Re: smd_qr_code: embed Quick Response barcodes on your site
I used Google Charts on my site to create a graph of plugin downloads. Very easy to use.
Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker
Offline
Re: smd_qr_code: embed Quick Response barcodes on your site
Alrighty, try v0.30. Features:
- A complete rewrite of the API interface, slimming it down to one multi-faceted function, plus some supporting methods
- Define your own custom data formats via the
layout
attribute (subject to Google’s 2KB data limit) - Define your own custom transformations via the
transform
attribute (the newprefix
attribute has a supporting role here) - Improvements to the
validate
attribute so you can now copy existing regexes, plus a shortcut for validating all fields when you’ve singled out one or two for special treatment
All in all, this is a huge rewrite so although it’s largely backwards compatible I’ve bumped the major version number. Adi, you can check out the plugin docs under ‘Custom types’ for an example that you can adapt to address your requirements.
Hope this version scratches more itches for everyone. Let me know how it goes and, specificaly, if I can add any custom transforms to the core plugin that you think are everyday useful.
shayne wrote:
margin doesn’t seem to be working
Hmmm, an odd one this. I hadn’t noticed, but I did some experimenting directly via the charts API wizard and it behaves erratically there too, so it’s not the plugin misbehaving. It seems that some margin/quality/size settings render the same image and only when the margin goes up significantly (e.g. at 3, 6, 11 and so on) does the margin actually change visually. Weird. I’ve made a note in the docs, thanks for bringing it to my attention.
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
Online
#23 2011-04-05 00:02:55
- gomedia
- Plugin Author
- Registered: 2008-06-01
- Posts: 1,373
Re: smd_qr_code: embed Quick Response barcodes on your site
Offline
Re: smd_qr_code: embed Quick Response barcodes on your site
Thanks to Adi’s feedback, here’s a bug fix release v0.31
- Fixed double quote / newline issues so that
\r\n
works as advertised - Fixed plugin warning when no plugin callbacks are defined
Much hat tipping to Adi for testing this and helping make the plugin better.
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
Online