Files
zzw b77a1f1b95
CI / changes (push) Successful in 1m31s
CI / ad (push) Successful in 32s
CI / admin (push) Successful in 26s
CI / analysis (push) Successful in 28s
CI / bff (push) Successful in 23s
CI / chore (push) Successful in 24s
CI / equipment (push) Successful in 21s
CI / express (push) Successful in 21s
CI / factory (push) Successful in 18s
CI / message (push) Successful in 18s
CI / order (push) Successful in 21s
CI / payment (push) Successful in 20s
CI / percutaneous (push) Successful in 19s
CI / product (push) Successful in 21s
CI / record (push) Successful in 21s
CI / sale (push) Successful in 20s
CI / store (push) Successful in 25s
CI / support (push) Successful in 21s
CI / task (push) Successful in 20s
CI / user (push) Successful in 22s
CI / water (push) Successful in 20s
CI / wecom (push) Successful in 21s
CI / ws (push) Successful in 8s
feat: user improve
2026-10-27 13:01:24 +08:00

28 lines
523 B
Go

package callback
import (
"bytes"
"fmt"
"strings"
"github.com/disintegration/imaging"
)
func Rotate90Bytes(data []byte, ext string) ([]byte, error) {
img, err := imaging.Decode(bytes.NewReader(data))
if err != nil {
return nil, err
}
img = imaging.Rotate90(img)
format := imaging.JPEG
if strings.EqualFold(ext, ".png") {
format = imaging.PNG
}
var buf bytes.Buffer
if err = imaging.Encode(&buf, img, format); err != nil {
return nil, fmt.Errorf("encode image: %w", err)
}
return buf.Bytes(), nil
}