Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
watermark
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Odysseus
watermark
Commits
c29870db
Commit
c29870db
authored
Sep 12, 2024
by
贾浩@五瓣科技
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
6c272d59
Pipeline
#802
canceled with stages
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
3 deletions
+5
-3
Dockerfile
Dockerfile
+3
-1
watermark.go
watermark.go
+2
-2
No files found.
Dockerfile
View file @
c29870db
...
...
@@ -5,7 +5,9 @@ WORKDIR /app
COPY
watermark.go .
COPY
*.ttf /
COPY
zh.ttf .
COPY
en.ttf .
RUN
CGO_ENABLED
=
0
GOOS
=
linux go build
-o
watermark /app/watermark.go
...
...
main
.go
→
watermark
.go
View file @
c29870db
...
...
@@ -350,10 +350,10 @@ func addWatermarkMemeHandler(w http.ResponseWriter, r *http.Request) {
filter
:=
fmt
.
Sprintf
(
"pad=iw:ih+%d:0:0:black,"
,
temp
.
Height
)
for
i
:=
0
;
i
<
len
(
temp
.
Text
);
i
++
{
if
temp
.
Chinese
{
filter
+=
fmt
.
Sprintf
(
"drawtext=fontfile=/zh.ttf:text='%s':fontsize=%d:fontcolor=white:x=%d:y=h-%d+%d,"
,
temp
.
Text
[
i
],
temp
.
Fontsize
,
temp
.
Position
[
i
][
0
],
temp
.
Height
,
temp
.
Position
[
i
][
1
])
filter
+=
fmt
.
Sprintf
(
"drawtext=fontfile=/
app/
zh.ttf:text='%s':fontsize=%d:fontcolor=white:x=%d:y=h-%d+%d,"
,
temp
.
Text
[
i
],
temp
.
Fontsize
,
temp
.
Position
[
i
][
0
],
temp
.
Height
,
temp
.
Position
[
i
][
1
])
continue
}
filter
+=
fmt
.
Sprintf
(
"drawtext=fontfile=/en.ttf:text='%s':fontsize=%d:fontcolor=white:x=%d:y=h-%d+%d,"
,
temp
.
Text
[
i
],
temp
.
Fontsize
,
temp
.
Position
[
i
][
0
],
temp
.
Height
,
temp
.
Position
[
i
][
1
])
filter
+=
fmt
.
Sprintf
(
"drawtext=fontfile=/
app/
en.ttf:text='%s':fontsize=%d:fontcolor=white:x=%d:y=h-%d+%d,"
,
temp
.
Text
[
i
],
temp
.
Fontsize
,
temp
.
Position
[
i
][
0
],
temp
.
Height
,
temp
.
Position
[
i
][
1
])
}
args
=
append
(
args
,
filter
[
:
len
(
filter
)
-
1
],
outputPath
)
...
...
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