mirror of
https://github.com/aljazceru/njump.git
synced 2026-01-31 19:54:29 +01:00
embed logo in the binary.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"embed"
|
||||
"fmt"
|
||||
@@ -36,6 +37,9 @@ var (
|
||||
//go:embed fonts/*
|
||||
var fonts embed.FS
|
||||
|
||||
//go:embed static/logo.png
|
||||
var logo []byte
|
||||
|
||||
func renderImage(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Println(r.URL.Path, ":~", r.Header.Get("user-agent"))
|
||||
|
||||
@@ -186,12 +190,8 @@ func drawImage(lines []string, ttf *truetype.Font, style Style) (image.Image, er
|
||||
img.DrawString(line, float64(20+paddingLeft), y) // Draw the line at the calculated Y position
|
||||
}
|
||||
|
||||
// Create the stamp image
|
||||
stampImg, err := gg.LoadPNG("static/logo.png")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// create the stamp image
|
||||
stampImg, _ := png.Decode(bytes.NewBuffer(logo))
|
||||
stampWidth := stampImg.Bounds().Dx()
|
||||
stampHeight := stampImg.Bounds().Dy()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user