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
7fb9462f
Commit
7fb9462f
authored
Sep 12, 2024
by
贾浩@五瓣科技
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
c29870db
Pipeline
#803
failed with stages
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
2 deletions
+5
-2
Dockerfile
Dockerfile
+3
-0
watermark.go
watermark.go
+2
-2
No files found.
Dockerfile
View file @
7fb9462f
...
@@ -15,6 +15,9 @@ RUN CGO_ENABLED=0 GOOS=linux go build -o watermark /app/watermark.go
...
@@ -15,6 +15,9 @@ RUN CGO_ENABLED=0 GOOS=linux go build -o watermark /app/watermark.go
FROM
linuxserver/ffmpeg:7.0.1
FROM
linuxserver/ffmpeg:7.0.1
COPY
--from=build /app/watermark /usr/local/bin/watermark
COPY
--from=build /app/watermark /usr/local/bin/watermark
COPY
--from=build /app/zh.ttf /zh.ttf
COPY
--from=build /app/en.ttf /en.ttf
EXPOSE
8080
EXPOSE
8080
...
...
watermark.go
View file @
7fb9462f
...
@@ -350,10 +350,10 @@ func addWatermarkMemeHandler(w http.ResponseWriter, r *http.Request) {
...
@@ -350,10 +350,10 @@ func addWatermarkMemeHandler(w http.ResponseWriter, r *http.Request) {
filter
:=
fmt
.
Sprintf
(
"pad=iw:ih+%d:0:0:black,"
,
temp
.
Height
)
filter
:=
fmt
.
Sprintf
(
"pad=iw:ih+%d:0:0:black,"
,
temp
.
Height
)
for
i
:=
0
;
i
<
len
(
temp
.
Text
);
i
++
{
for
i
:=
0
;
i
<
len
(
temp
.
Text
);
i
++
{
if
temp
.
Chinese
{
if
temp
.
Chinese
{
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
])
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
])
continue
continue
}
}
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
])
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
])
}
}
args
=
append
(
args
,
filter
[
:
len
(
filter
)
-
1
],
outputPath
)
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