Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Luc Didry
wemawema
Commits
f58cb30f
Commit
f58cb30f
authored
Sep 27, 2017
by
Luc Didry
Browse files
Handle 'text' argument (for mattermost)
parent
52180304
Pipeline
#23886
passed with stage
in 16 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
README.md
0 → 100644
View file @
f58cb30f
sudo apt-get install libcairo2-dev libjpeg-dev libpango1.0-dev libgif-dev build-essential
server/wemawema.js
View file @
f58cb30f
...
...
@@ -20,6 +20,10 @@ const requestHandler = (request, response) => {
var
py
=
(
queryData
.
py
!==
undefined
)
?
queryData
.
py
:
'
350
'
;
var
ps
=
(
queryData
.
ps
!==
undefined
)
?
queryData
.
ps
:
'
220
'
;
if
(
queryData
.
text
!==
undefined
)
{
p
=
queryData
.
text
;
}
ctx
.
fillStyle
=
'
rgba(252, 210, 5, 1)
'
;
roundRect
(
ctx
,
0
,
0
,
800
,
400
,
20
,
true
,
false
);
...
...
@@ -34,11 +38,9 @@ const requestHandler = (request, response) => {
ctx
.
fillStyle
=
'
rgba(0, 0, 0, 1)
'
;
var
i
=
0
;
console
.
log
(
'
w:
'
+
ctx
.
measureText
(
w
).
width
);
while
(
ctx
.
measureText
(
w
).
width
>
725
)
{
ctx
.
font
=
'
bold
'
+
(
parseInt
(
ws
)
-
i
++
)
+
'
px sans-serif
'
;
}
console
.
log
(
'
w:
'
+
ctx
.
measureText
(
w
).
width
);
ctx
.
fillText
(
w
,
parseInt
(
wx
),
parseInt
(
wy
));
// Write new value
...
...
@@ -46,11 +48,9 @@ const requestHandler = (request, response) => {
ctx
.
fillStyle
=
'
rgba(0, 0, 0, 1)
'
;
i
=
0
;
console
.
log
(
'
p:
'
+
ctx
.
measureText
(
p
).
width
);
while
(
ctx
.
measureText
(
p
).
width
>
725
)
{
ctx
.
font
=
'
bold
'
+
(
parseInt
(
ps
)
-
i
++
)
+
'
px sans-serif
'
;
}
console
.
log
(
'
p:
'
+
ctx
.
measureText
(
p
).
width
);
ctx
.
fillText
(
p
,
parseInt
(
px
),
parseInt
(
py
));
var
data
=
canvas
.
toDataURL
().
replace
(
'
data:image/png;base64,
'
,
''
);
...
...
Write
Preview
Supports
Markdown
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