Fix GeoGebra thumbnails when libvips support is enabled

For GeoGebra files we where still using the imaging package to decode the
embedded png, but handed it of to vips for scaling, which can't work. Now
we use vips for decoding the image as well.
This commit is contained in:
Ralf Haferkamp
2024-10-17 14:05:27 +02:00
committed by Ralf Haferkamp
parent 2feb1ab0cf
commit b63676ff93
2 changed files with 7 additions and 3 deletions
@@ -12,7 +12,6 @@ import (
"mime"
"strings"
"github.com/kovidgoyal/imaging"
"github.com/pkg/errors"
"golang.org/x/image/font"
"golang.org/x/image/font/opentype"
@@ -60,8 +59,11 @@ func (g GgsDecoder) Convert(r io.Reader) (interface{}, error) {
if err != nil {
return nil, err
}
img, err := imaging.Decode(thumbnail, imaging.AutoOrientation(true))
converter := ForType("image/png", nil)
if converter == nil {
return nil, thumbnailerErrors.ErrNoConverterForExtractedImageFromGgsFile
}
img, err := converter.Convert(thumbnail)
if err != nil {
return nil, errors.Wrap(err, `could not decode the image`)
}