Added some documentation on how to use the erlang qrcode library
This commit is contained in:
parent
b0110e5963
commit
2d7f0e8fbb
@ -25,3 +25,35 @@ Demo
|
||||
8. Handle PINs/logins for the second part of the "two factor" according to your application design.
|
||||
|
||||
NOTE: This documentation is rather basic as this was open-sourced by specific request!
|
||||
|
||||
|
||||
How to use QR Code Encoder with Elixir
|
||||
======================================
|
||||
|
||||
For now, the only way to compile qrcode is to start erlang, and compile all the files manually.
|
||||
::
|
||||
|
||||
cd src
|
||||
erl
|
||||
|
||||
# In the interpreter, type the following:
|
||||
c(gf256)
|
||||
c(qrcode_demo)
|
||||
c(qrcode_mask)
|
||||
c(qrcode_matrix)
|
||||
c(base32)
|
||||
c(bits)
|
||||
c(qrcode_demo)
|
||||
c(qrcode)
|
||||
c(qrcode_reedsolomon)
|
||||
|
||||
Then, whenever you have this compiled, you should have access to the functions avaiable in elixir.
|
||||
|
||||
iex(1)> qrcode = :qrcode.encode(“bla”)
|
||||
{:qrcode, 1, :M, 29,
|
||||
<<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 254, 211, 248, 4, 16, 208, 64, 46, 152, ...>>}
|
||||
iex(2)> png = :qrcode_demo.simple_png_encode(qrcode)
|
||||
<<137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 0, 232, 0, 0, 0, ...>>
|
||||
iex(3)> :file.write_file(“example.png”, png)
|
||||
:ok
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user