Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lua-resty-qrencode
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jiming
lua-resty-qrencode
Commits
a0d59c8b
Commit
a0d59c8b
authored
Mar 22, 2017
by
orangle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add new makefile
parent
224860e0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
24 deletions
+70
-24
Makefile
+34
-9
README.md
+36
-15
No files found.
Makefile
View file @
a0d59c8b
# Makefile for qrencode library for Lua
# Makefile for qrencode library for Lua
version
=
0.1
LIBNAME
=
qrencode
name
=
lua-resty-qrencode
LUA_VERSION
=
5.1
LUAEXE
=
lua
# See http://lua-users.org/wiki/BuildingModules for platform specific
# details.
ROCKSPEC
=
$(
shell
find
.
-name
$(LIBNAME)
-
*
-
*
.rockspec
)
## Linux/BSD
PREFIX
?=
/usr/local/openresty
#LDFLAGS += -shared
all
:
install
## OSX (Macports)
#PREFIX ?= /opt/local
LDFLAGS
+=
-bundle
-undefined
dynamic_lookup
install
:
## find your luajit path
luarocks make
$(ROCKSPEC)
LUA_INCLUDE_DIR
?=
$(PREFIX)
/luajit/include/luajit-2.1
LUA_LIB_DIR
?=
$(PREFIX)
/lualib
# Some versions of Solaris are missing isinf(). Add -DMISSING_ISINF to
# CFLAGS to work around this bug.
#CFLAGS ?= -g -Wall -pedantic -fno-inline
CFLAGS
?=
-g
-O3
-Wall
-pedantic
override
CFLAGS
+=
-fpic
-I
$(LUA_INCLUDE_DIR)
-lpng
-lqrencode
INSTALL
?=
install
test
:
.PHONY
:
all clean install
$(LUAEXE)
test
/test.lua
.PHONY
:
all test install
all
:
qrencode.so
qrencode.so
:
qrencode.c
$(CC)
$(LDFLAGS)
$(CFLAGS)
-o
$@
$^
install
:
$(INSTALL)
-d
$(LUA_LIB_DIR)
$(INSTALL)
qrencode.so
$(LUA_LIB_DIR)
clean
:
rm
*
.so
README.md
View file @
a0d59c8b
...
@@ -11,24 +11,39 @@ qrencode is dependent on [libqrencode](http://fukuchi.org/works/qrencode/)
...
@@ -11,24 +11,39 @@ qrencode is dependent on [libqrencode](http://fukuchi.org/works/qrencode/)
and
[
libpng
](
http://www.libpng.org/pub/png/libpng.html
)
, so make sure these are installed
and
[
libpng
](
http://www.libpng.org/pub/png/libpng.html
)
, so make sure these are installed
before compile it.
before compile it.
##
Example usage
##
# MacOS
```
lua
```
qr
=
require
"qrencode"
$ brew install libqrencode
$ https://github.com/orangle/lua-resty-qrencode.git
$ cd lua-resty-qrencode
$ make
$ make install
```
defalut openresty
`PREFIX`
is
`/usr/local/openresty`
, if you have a different path, please read
`Makefile`
and change the path.
### Other
-- print PNG data stream to stdout
.
please install libqrencode and libpng, and read Makefile
.
print
(
qr
.
encode
(
"is ok?"
))
print
(
qr
:
encode
(
"is ok?"
))
print
(
qr
(
"is ok?"
))
-- print ansi char
## Example usage
print
(
qr
{
text
=
"is ok?"
,
ansi
=
true
})
```
lua
location
/
qrcode
{
content_by_lua_block
{
local
qr
=
require
(
"qrencode"
)
local
args
=
ngx
.
req
.
get_uri_args
()
local
text
=
args
.
text
-- or pass a table :
if
text
==
nil
or
text
==
""
then
ngx
.
say
(
'need a text param'
)
ngx
.
exit
(
404
)
end
print
(
qr
{
ngx
.
say
(
qr
{
text
=
"is ok?"
,
text
=
text
,
level
=
"L"
,
level
=
"L"
,
kanji
=
false
,
kanji
=
false
,
ansi
=
true
,
ansi
=
true
,
...
@@ -36,11 +51,17 @@ print(qr {
...
@@ -36,11 +51,17 @@ print(qr {
margin
=
2
,
margin
=
2
,
symversion
=
0
,
symversion
=
0
,
dpi
=
78
,
dpi
=
78
,
casesensitive
=
fals
e
,
casesensitive
=
tru
e
,
foreground
=
"48AF6D"
,
foreground
=
"48AF6D"
,
background
=
"3FAF6F"
background
=
"3FAF6F"
}
})
)
}
}
```
test url like
```
curl 'http://127.0.0.1:8008/qrcode?text=http://orangleliu.info'
```
```
when pass a table, "text" is required and other is optional.
when pass a table, "text" is required and other is optional.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment