a bigger shrinker for uploads
This commit is contained in:
parent
1b36e72cc1
commit
0dd17d0038
25
backend.go
25
backend.go
|
@ -83,6 +83,31 @@ func imageFromSVG(data []byte) (*image.Image, error) {
|
|||
return svg, nil
|
||||
}
|
||||
|
||||
func bigshrink(data []byte) (*image.Image, error) {
|
||||
if isSVG(data) {
|
||||
return imageFromSVG(data)
|
||||
}
|
||||
cl, err := rpc.Dial("unix", backendSockname())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer cl.Close()
|
||||
var res ShrinkerResult
|
||||
err = cl.Call("Shrinker.Shrink", &ShrinkerArgs{
|
||||
Buf: data,
|
||||
Params: image.Params{
|
||||
LimitSize: 14200 * 4200,
|
||||
MaxWidth: 2600,
|
||||
MaxHeight: 2048,
|
||||
MaxSize: 768 * 1024,
|
||||
},
|
||||
}, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return res.Image, nil
|
||||
}
|
||||
|
||||
func shrinkit(data []byte) (*image.Image, error) {
|
||||
if isSVG(data) {
|
||||
return imageFromSVG(data)
|
||||
|
|
Loading…
Reference in New Issue