0
Fork 0
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:
Will Norris 2015-05-29 07:31:10 -07:00
parent 0fd85dc016
commit db51a19ddb

View file

@ -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