1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2025-01-08 10:45:04 +02:00
imgproxy/svg.go

21 lines
544 B
Go
Raw Normal View History

2018-12-11 12:02:23 +02:00
package main
import (
"image"
"image/color"
2018-12-11 12:02:23 +02:00
"io"
)
func init() {
// Register fake svg decoder. Since we need this only for type detecting, we can
// return fake image sizes
2019-02-21 18:20:44 +02:00
decode := func(io.Reader) (image.Image, error) {
return image.NewRGBA(image.Rect(0, 0, 1, 1)), nil
}
decodeConfig := func(io.Reader) (image.Config, error) {
return image.Config{ColorModel: color.RGBAModel, Width: 1, Height: 1}, nil
}
image.RegisterFormat("svg", "<?xml ", decode, decodeConfig)
image.RegisterFormat("svg", "<svg", decode, decodeConfig)
2018-12-11 12:02:23 +02:00
}