bloaty pig posters and their images of unusual size
This commit is contained in:
parent
20b67a8030
commit
b0b0ad21df
13
activity.go
13
activity.go
|
@ -22,6 +22,7 @@ import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"image"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -217,7 +218,17 @@ func savedonk(url string, name, media string) *Donk {
|
||||||
|
|
||||||
xid := xfiltrate()
|
xid := xfiltrate()
|
||||||
|
|
||||||
res, err := stmtSaveFile.Exec(xid, name, url, media, buf.Bytes())
|
data := buf.Bytes()
|
||||||
|
if strings.HasPrefix(media, "image") {
|
||||||
|
img, format, err := image.Decode(&buf)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("unable to decode image: %s", err)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
data, format, err = vacuumwrap(img, format)
|
||||||
|
media = "image/" + format
|
||||||
|
}
|
||||||
|
res, err := stmtSaveFile.Exec(xid, name, url, media, data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("error saving file %s: %s", url, err)
|
log.Printf("error saving file %s: %s", url, err)
|
||||||
return nil
|
return nil
|
||||||
|
|
5
honk.go
5
honk.go
|
@ -24,9 +24,6 @@ import (
|
||||||
"html"
|
"html"
|
||||||
"html/template"
|
"html/template"
|
||||||
"image"
|
"image"
|
||||||
_ "image/gif"
|
|
||||||
_ "image/jpeg"
|
|
||||||
_ "image/png"
|
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
notrand "math/rand"
|
notrand "math/rand"
|
||||||
|
@ -1129,7 +1126,7 @@ func killitwithfire(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
db := opendatabase()
|
db := opendatabase()
|
||||||
db.Exec("insert into zonkers (userid, name, wherefore) values (?, ?, ?)",
|
db.Exec("insert into zonkers (userid, name, wherefore) values (?, ?, ?)",
|
||||||
userinfo.UserID, name, wherefore)
|
userinfo.UserID, name, wherefore)
|
||||||
if wherefore == "zonker" || wherefore == "zurl" {
|
if wherefore == "zonker" || wherefore == "zurl" {
|
||||||
bitethethumbs()
|
bitethethumbs()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue