1
0
mirror of https://github.com/axllent/mailpit.git synced 2025-01-22 03:39:59 +02:00

Chore: Auto-rotate thumbnail images based on exif data

This commit is contained in:
Ralph Slooten 2024-04-18 18:04:43 +12:00
parent 7085690e3d
commit 96c33b1233

View File

@ -12,9 +12,9 @@ import (
"github.com/axllent/mailpit/internal/logger"
"github.com/axllent/mailpit/internal/storage"
"github.com/kovidgoyal/imaging"
"github.com/gorilla/mux"
"github.com/jhillyerd/enmime"
"github.com/kovidgoyal/imaging"
)
var (
@ -74,7 +74,7 @@ func Thumbnail(w http.ResponseWriter, r *http.Request) {
buf := bytes.NewBuffer(a.Content)
img, err := imaging.Decode(buf)
img, err := imaging.Decode(buf, imaging.AutoOrientation(true))
if err != nil {
// it's not an image, return default
logger.Log().Warnf("[image] %s", err.Error())