better image toolkit for prettier screenshots

This commit is contained in:
Ted Unangst 2019-06-05 02:13:01 -04:00
parent fb95988a64
commit f4b8fd8b97
4 changed files with 5 additions and 5 deletions

View File

@ -234,7 +234,7 @@ func savedonk(url string, name, media string, localize bool) *Donk {
data = buf.Bytes()
if strings.HasPrefix(media, "image") {
img, err := image.Vacuum(&buf)
img, err := image.Vacuum(&buf, image.Params{MaxWidth: 2048, MaxHeight: 2048})
if err != nil {
log.Printf("unable to decode image: %s", err)
localize = false

2
go.mod
View File

@ -6,5 +6,5 @@ require (
golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f
golang.org/x/net v0.0.0-20190522155817-f3200d17e092 // indirect
humungus.tedunangst.com/r/go-sqlite3 v1.1.3
humungus.tedunangst.com/r/webs v0.4.4
humungus.tedunangst.com/r/webs v0.5.1
)

4
go.sum
View File

@ -16,5 +16,5 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
humungus.tedunangst.com/r/go-sqlite3 v1.1.3 h1:G2N4wzDS0NbuvrZtQJhh4F+3X+s7BF8b9ga8k38geUI=
humungus.tedunangst.com/r/go-sqlite3 v1.1.3/go.mod h1:FtEEmQM7U2Ey1TuEEOyY1BmphTZnmiEjPsNLEAkpf/M=
humungus.tedunangst.com/r/webs v0.4.4 h1:uK1YW+eGQ0JADiSs7Ipt0ljFfQw7e73924wMm4V3gss=
humungus.tedunangst.com/r/webs v0.4.4/go.mod h1:79Ww3HmgE1m+HXU0r0b9hkOD3JuDzXoGiEauHuKcwBI=
humungus.tedunangst.com/r/webs v0.5.1 h1:I57oIU/ZkKclixRtXs0nJQUWe3Gq+9QVqL7BtV2vzAA=
humungus.tedunangst.com/r/webs v0.5.1/go.mod h1:79Ww3HmgE1m+HXU0r0b9hkOD3JuDzXoGiEauHuKcwBI=

View File

@ -874,7 +874,7 @@ func savehonk(w http.ResponseWriter, r *http.Request) {
data := buf.Bytes()
xid := xfiltrate()
var media, name string
img, err := image.Vacuum(&buf)
img, err := image.Vacuum(&buf, image.Params{MaxWidth: 2048, MaxHeight: 2048})
if err == nil {
data = img.Data
format := img.Format