Lasso Soft Inc. > Home

[QR_9]

LinkQR_9
AuthorRichard Fortnum
CategoryOutput
Version9.x
LicensePublic Domain
Posted12 Jul 2011
Updated12 Jul 2011
More by this author...

Description

Generate QR code & syntax in Lasso 9

Sample Usage

var('m') = qr(-size = 5, -margin = 10)
var('f') = lasso_uniqueid
$m->generate(
     -path = '///Library/Webserver/Documents/localtest/QR/files/', 
     -filename = $f + '.png', 
     -inputString = 'http://WWW.pints.com?flavour=' + $f)

'
' $m->version

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.

[
log_critical('loading qr type')

/*----------------------------------------------------------------------------

[QR]
QR Code Generator

Author: Rich Fortnum
Last Modified: Jul. 12, 2011
License: Public Domain


Modified for Lasso 9 by Jolle Carlestam


Description:



Sample Usage:
var('m') = qr(-size = 5, -margin = 10)
var('f') = lasso_uniqueid
$m->generate(
     -path = '///Library/Webserver/Documents/localtest/QR/files/', 
     -filename = $f + '.png', 
     -inputString = 'http://WWW.pints.com?flavour=' + $f)

'
' $m->version Latest version available from . ----------------------------------------------------------------------------*/ define qr => type { // =========== MEMBER data public size::integer data public error_collection::string data public version::string data public margin::integer data public structured::boolean data public kanji::boolean data public ignorecase::boolean data public eightbit::boolean data public qr_home::string // =========== CONSTRUCTOR public oncreate( size::integer = 3, error_collection::string = 'L', version::string = 'auto', margin::integer = 4, structured::boolean = true, kanji::boolean = false, ignorecase::boolean = true, eightbit::boolean = false, qr_home::string = 'qrencode' ) => { // ==> insert incoming parameters into the properties .size = #size .error_collection = #error_collection .version = #version .margin = #margin .structured = #structured .kanji = #kanji .ignorecase = #ignorecase .eightbit = #eightbit .qr_home = #qr_home } public oncreate( -size::integer = 3, -error_collection::string = 'L', -version::string = 'auto', -margin::integer = 4, -structured::boolean = true, -kanji::boolean = false, -ignorecase::boolean = true, -eightbit::boolean = false, -qr_home::string = 'qrencode' ) => { .oncreate(#size, #error_collection, #version, #margin, #structured, #kanji, #ignorecase, #eightbit, #qr_home) } // =========== METHOD /**! change generic set method **/ public change(property::string, value::any) => { match(#property) => { case('size') .size = #value case('error_collection') .error_collection = #value case('version') .version = #value case('margin') .margin = #value case('structured') .structured = #value case('kanji') .kanji = #value case('ignorecase') .ignorecase = #value case('eightbit') .eightbit = #value case('qr_home') .qr_home = #value } } /**! show_properties displays properties in a map **/ public show_properties() => { return map( 'size' = .size, 'error_collection' = .error_collection, 'version' = .version, 'margin' = .margin, 'structured' = .structured, 'kanji' = .kanji, 'ignorecase' = .ignorecase, 'eightbit' = .eightbit, 'qr_home' = .qr_home ) } /**! generate generates the QR code with the supplied location **/ public generate( path::string, // path has terminal "/" filename::string, inputstring::string, syntax_only::boolean = false ) => { fail_if(!#path -> beginswith('/') || !#path -> endswith('/'), -1, 'Path must start and end with a slash "/"') local(site_path = (file_forceRoot(response_Path) -> split('//')) -> removeall('')& -> first) if(#site_path -> split('/') -> first != #path -> split('/') -> removeall('')& -> first) => { // path is probably not pointing to the server root, change that #path = '///' + #site_path + #path } local(syntax = .'qr_home' + ' -o ' + #path + #filename + ' -s ' + .'size' + ' -l ' + .'error_collection' + ' -m ' + .'margin') .'kanji' ? #syntax += ' -k' .'ignorecase' ? #syntax += ' -i'| #syntax += ' -c' .'eightbit' ? #syntax += ' -8' #syntax += ' ' #inputString = string_replaceregexp(#inputString, -find = `'`, -replace = `'\'`) // ' #syntax += "'" + #inputString + "'" #syntax_only ? return #syntax shell(#syntax) // remember to match up this tagname to shell } public generate( -path::string, // path has terminal "/" -filename::string, -inputstring::string, -syntax_only::boolean = false ) => .generate(#path, #filename, #inputstring, #syntax_only) /**! version returns version of qrencode **/ public version() => shell(.'qr_home' + ' -V') // remember to match up this tagname to shell } log_critical('done loading qr type') ]

Related Tags

Comments

No comments

Please log in to comment

Subscribe to the LassoTalk mail list

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft