summaryrefslogtreecommitdiff
path: root/internal/media/metadata.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2024-08-08 17:12:13 +0000
committerLibravatar GitHub <noreply@github.com>2024-08-08 17:12:13 +0000
commitf77005128a391025c16fb65c47a4272ac003cbf1 (patch)
treeba73e2b475e3c567d47abee1bccca5a99184c02d /internal/media/metadata.go
parent[feature] Add `db-postgres-connection-string` option (#3178) (diff)
downloadgotosocial-f77005128a391025c16fb65c47a4272ac003cbf1.tar.xz
[performance] move thumbnail generation to go code where possible (#3183)
* wrap thumbnailing code to handle generation natively where possible * more code comments! * add even more code comments! * add code comments about blurhash generation * maintain image rotation if contained in exif data * move rotation before resizing * ensure pix_fmt actually selected by ffprobe, check for alpha layer with gifs * use linear instead of nearest-neighbour for resizing * work with image "orientation" instead of "rotation". use default 75% quality for both webp and jpeg generation * add header to new file * use thumb extension when getting thumb mime type * update test models and tests with new media processing * add suggested code comments * add note about thumbnail filter count reducing memory usage
Diffstat (limited to 'internal/media/metadata.go')
-rw-r--r--internal/media/metadata.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/internal/media/metadata.go b/internal/media/metadata.go
index cccfc8296..e9256f1b1 100644
--- a/internal/media/metadata.go
+++ b/internal/media/metadata.go
@@ -47,9 +47,14 @@ func clearMetadata(ctx context.Context, filepath string) error {
// cleaning exif data using a native Go library.
log.Debug(ctx, "cleaning with exif-terminator")
err := terminateExif(outpath, filepath, ext)
- if err != nil {
- return err
+ if err == nil {
+ // No problem.
+ break
}
+
+ log.Warnf(ctx, "error cleaning with exif-terminator, falling back to ffmpeg: %v", err)
+ fallthrough
+
default:
// For all other types, best-effort clean with ffmpeg.
log.Debug(ctx, "cleaning with ffmpeg -map_metadata -1")