mirror of
https://github.com/axllent/mailpit.git
synced 2025-07-17 01:32:33 +02:00
Chore: Auto-rotate thumbnail images based on exif data
This commit is contained in:
@ -12,9 +12,9 @@ import (
|
|||||||
|
|
||||||
"github.com/axllent/mailpit/internal/logger"
|
"github.com/axllent/mailpit/internal/logger"
|
||||||
"github.com/axllent/mailpit/internal/storage"
|
"github.com/axllent/mailpit/internal/storage"
|
||||||
"github.com/kovidgoyal/imaging"
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
"github.com/jhillyerd/enmime"
|
"github.com/jhillyerd/enmime"
|
||||||
|
"github.com/kovidgoyal/imaging"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -74,7 +74,7 @@ func Thumbnail(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
buf := bytes.NewBuffer(a.Content)
|
buf := bytes.NewBuffer(a.Content)
|
||||||
|
|
||||||
img, err := imaging.Decode(buf)
|
img, err := imaging.Decode(buf, imaging.AutoOrientation(true))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// it's not an image, return default
|
// it's not an image, return default
|
||||||
logger.Log().Warnf("[image] %s", err.Error())
|
logger.Log().Warnf("[image] %s", err.Error())
|
||||||
|
Reference in New Issue
Block a user