Author Topic: Generate QR code  (Read 3178 times)

Offline jalih

  • Advocate
  • Posts: 109
Generate QR code
« on: March 17, 2019, 02:58:18 AM »
Your challenge is to generate a QR code for All BASIC forum website using your favorite programming language and library.

Below is a simple 8th version using built-in capability.

Code: [Select]
needs utils/qrcode

: fname "qr.png" ;
: qr-str "https://www.allbasic.info/forum/index.php" ;

: app:main
  qr-str img:ECC-LOW img:qr-gen img:qr>img
  fname f:rm drop
  fname img:>file
  bye ;

Offline John

  • Forum Support / SB Dev
  • Posts: 3558
    • ScriptBasic Open Source Project
Re: Generate QR code
« Reply #1 on: March 17, 2019, 08:47:27 AM »



Code: [Select]
http://api.qrserver.com/v1/create-qr-code/?data=https%3A%2F%2Fwww.allbasic.info%2Fforum%2Findex.php&size=125x125


« Last Edit: March 18, 2019, 06:10:43 PM by John »

Offline AIR

  • BASIC Developer
  • Posts: 932
  • Coder
Re: Generate QR code
« Reply #2 on: March 17, 2019, 08:29:07 PM »
GO:

Code: Go
  1. package main
  2.  
  3. import (
  4.         "os"
  5.  
  6.         qrcode "github.com/skip2/go-qrcode"
  7. )
  8.  
  9. func main() {
  10.         err := qrcode.WriteFile("https://www.allbasic.info/forum/index.php", qrcode.Medium, 256, "qr.png")
  11.         if err != nil {
  12.                 println("Error generating QR image...")
  13.                 os.Exit(-1)
  14.         }
  15. }
  16.  

Offline John

  • Forum Support / SB Dev
  • Posts: 3558
    • ScriptBasic Open Source Project
Re: Generate QR code
« Reply #3 on: March 17, 2019, 09:12:14 PM »
I like the GO feature of being able to include code from the web.

I'm going to try using SB's pre-processor to acomplishish the same effect.