[feature] media: add webp support (#1155)

* media: add webp support

Signed-off-by: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>

* bump exif-terminator to v0.5.0

Signed-off-by: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>

Signed-off-by: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
This commit is contained in:
Sigrid Solveig Haflínudóttir
2022-12-06 14:15:25 +01:00
committed by GitHub
parent f9e5ec99bd
commit 1a3f26fb5c
26 changed files with 4348 additions and 19 deletions

View File

@@ -215,7 +215,7 @@ func (p *ProcessingMedia) loadFullSize(ctx context.Context) error {
// decode the image
ct := p.attachment.File.ContentType
switch ct {
case mimeImageJpeg, mimeImagePng:
case mimeImageJpeg, mimeImagePng, mimeImageWebp:
decoded, err = decodeImage(stored, ct)
case mimeImageGif:
decoded, err = decodeGif(stored)
@@ -319,7 +319,7 @@ func (p *ProcessingMedia) store(ctx context.Context) error {
p.attachment.Type = gtsmodel.FileTypeImage
// nothing to terminate, we can just store the multireader
readerToStore = multiReader
case mimeJpeg, mimePng:
case mimeJpeg, mimePng, mimeWebp:
p.attachment.Type = gtsmodel.FileTypeImage
if fileSize > 0 {
terminated, err := terminator.Terminate(multiReader, int(fileSize), extension)