Add skel for preview generator for ggs
Co-authored-by: Ralf Haferkamp <rhafer@owncloud.com> Signed-off-by: Christian Richter <crichter@owncloud.com>
This commit is contained in:
co-authored by
Ralf Haferkamp
parent
103377e12f
commit
1713041e14
@@ -15,6 +15,7 @@ const (
|
||||
typeJpg = "jpg"
|
||||
typeJpeg = "jpeg"
|
||||
typeGif = "gif"
|
||||
typeGgs = "ggs"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -119,6 +120,8 @@ func GetExtForMime(fileType string) string {
|
||||
switch ext {
|
||||
case typeJpg, typeJpeg, typePng, typeGif:
|
||||
return ext
|
||||
case "application/vnd.geogebra.slides":
|
||||
return typeGgs
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
|
||||
@@ -71,6 +71,14 @@ func (g GifGenerator) imageToPaletted(img image.Image, p color.Palette) *image.P
|
||||
return pm
|
||||
}
|
||||
|
||||
// GgsGenerator is used to create a web friendly version of the provided ggs image.
|
||||
type GgsGenerator struct{}
|
||||
|
||||
func (g GgsGenerator) Generate(size image.Rectangle, img interface{}, processor Processor) (interface{}, error) {
|
||||
// TODO: write zip extractor, get image from zip, process image, return image
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// GeneratorForType returns the generator for a given file type
|
||||
// or nil if the type is not supported.
|
||||
func GeneratorForType(fileType string) (Generator, error) {
|
||||
@@ -79,6 +87,8 @@ func GeneratorForType(fileType string) (Generator, error) {
|
||||
return SimpleGenerator{}, nil
|
||||
case typeGif:
|
||||
return GifGenerator{}, nil
|
||||
case typeGgs:
|
||||
return GgsGenerator{}, nil
|
||||
default:
|
||||
return nil, ErrNoEncoderForType
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user