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:
Christian Richter
2023-11-23 17:26:15 +01:00
parent 103377e12f
commit 1713041e14
4 changed files with 20 additions and 2 deletions

View File

@@ -111,6 +111,12 @@ func defaultMimeTypeConfig() []config.MimeTypeConfig {
Name: "Compressed markdown file",
Description: "Compressed markdown file",
},
{
MimeType: "application/vnd.geogebra.slides",
Extension: "ggs",
Name: "GeoGebra Slides",
Description: "GeoGebra Slides",
},
}
}

View File

@@ -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 ""
}

View File

@@ -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
}

View File

@@ -106,14 +106,13 @@ func DefaultConfig() *config.Config {
"image/tiff",
"image/bmp",
"image/x-ms-bmp",
"application/vnd.geogebra.slides",
},
},
},
},
Options: config.Options{
ContextHelpersReadMore: true,
PreviewFileMimeTypes: []string{"image/gif", "image/png", "image/jpeg", "text/plain", "image/tiff", "image/bmp", "image/x-ms-bmp"},
PreviewFileMimeTypes: []string{"image/gif", "image/png", "image/jpeg", "text/plain", "image/tiff", "image/bmp", "image/x-ms-bmp", "application/vnd.geogebra.slides"},
SharingRecipientsPerPage: 200,
AccountEditLink: &config.AccountEditLink{},
Editor: &config.Editor{},