mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-05-24 16:41:35 -04:00
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:
@@ -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",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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{},
|
||||
|
||||
Reference in New Issue
Block a user