Commit 7fb9462f authored by 贾浩@五瓣科技's avatar 贾浩@五瓣科技

update

parent c29870db
Pipeline #803 failed with stages
...@@ -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
......
...@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment