mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-09-13 06:09:21 -04:00
webdav now owns the complete thumbnail pipeline: stat -> validate -> cache check -> download -> preprocess -> generate -> cache -> respond. The thumbnails service is used only as a stateless imagor-compatible image resizer via its /unsafe push endpoint. - New ThumbnailWorkflow drives the pipeline; space-scoped refs are anchored at the space ResourceId and downloads authenticate with the user's x-access-token. - Preprocessing (audio/geogebra/text/gif) moves from the thumbnails service into webdav (services/webdav/pkg/preprocessor). - Thumbnail caching moves to webdav (memory/file/s3 backends, file cache off by default); resolutions are snapped orientation-aware in webdav. - Generator URL defaults to the local thumbnails service; new WEBDAV_* config for generator, cache and resolutions. - Acceptance tests updated for the new sizing/processor behavior.
23 lines
486 B
Go
23 lines
486 B
Go
//go:build !enable_vips
|
|
|
|
package preprocessor
|
|
|
|
import (
|
|
"io"
|
|
|
|
"github.com/kovidgoyal/imaging"
|
|
"github.com/pkg/errors"
|
|
)
|
|
|
|
// ImageDecoder is a converter for the image file
|
|
type ImageDecoder struct{}
|
|
|
|
// Convert reads the image file and returns the thumbnail image
|
|
func (i ImageDecoder) Convert(r io.Reader) (any, error) {
|
|
img, err := imaging.Decode(r, imaging.AutoOrientation(true))
|
|
if err != nil {
|
|
return nil, errors.Wrap(err, `could not decode the image`)
|
|
}
|
|
return img, nil
|
|
}
|