mirror of
https://github.com/willnorris/imageproxy.git
synced 2024-12-16 21:56:43 -05:00
capture and return image encoding errors
This commit is contained in:
parent
0fd85dc016
commit
db51a19ddb
1 changed files with 8 additions and 2 deletions
10
transform.go
10
transform.go
|
@ -64,10 +64,16 @@ func Transform(img []byte, opt Options) ([]byte, error) {
|
|||
}
|
||||
|
||||
m = transformImage(m, opt)
|
||||
jpeg.Encode(buf, m, &jpeg.Options{Quality: quality})
|
||||
err = jpeg.Encode(buf, m, &jpeg.Options{Quality: quality})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
case "png":
|
||||
m = transformImage(m, opt)
|
||||
png.Encode(buf, m)
|
||||
err = png.Encode(buf, m)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return buf.Bytes(), nil
|
||||
|
|
Loading…
Reference in a new issue