auto orientate pictures for thumbnails

This commit is contained in:
David Christofas
2022-09-05 16:33:29 +02:00
parent 29f52515e1
commit bff9c2b3cd
2 changed files with 8 additions and 1 deletions
@@ -10,6 +10,7 @@ import (
"mime"
"strings"
"github.com/disintegration/imaging"
"github.com/pkg/errors"
"golang.org/x/image/font"
"golang.org/x/image/font/opentype"
@@ -23,7 +24,7 @@ type FileConverter interface {
type ImageDecoder struct{}
func (i ImageDecoder) Convert(r io.Reader) (interface{}, error) {
img, _, err := image.Decode(r)
img, err := imaging.Decode(r, imaging.AutoOrientation(true))
if err != nil {
return nil, errors.Wrap(err, `could not decode the image`)
}