Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
chore: set max thumbnail width to home/explore image max width (#3852)
RoccoSmitbfe57b92021e
diff --git a/server/router/api/v1/resource_service.go b/server/router/api/v1/resource_service.goindex 63523cbf0..bca5360a6 100644--- a/server/router/api/v1/resource_service.go+++ b/server/router/api/v1/resource_service.go@@ -5,6 +5,7 @@ import ("context""encoding/binary""fmt"+ "image""io""log/slog""os"@@ -434,11 +435,19 @@ func (s *APIV1Service) getOrGenerateThumbnail(resource *store.Resource) ([]byte,if err != nil {return nil, errors.Wrap(err, "failed to get resource blob")}- image, err := imaging.Decode(bytes.NewReader(blob), imaging.AutoOrientation(true))+ img, err := imaging.Decode(bytes.NewReader(blob), imaging.AutoOrientation(true))if err != nil {return nil, errors.Wrap(err, "failed to decode thumbnail image")}- thumbnailImage := imaging.Resize(image, 512, 0, imaging.Lanczos)++ thumbnailMaxWidth := 700 // equal to home/explore screen image max width+ var thumbnailImage image.Image+ if img.Bounds().Max.X > thumbnailMaxWidth {+ thumbnailImage = imaging.Resize(img, thumbnailMaxWidth, 0, imaging.Lanczos)+ } else {+ thumbnailImage = img+ }+if err := imaging.Save(thumbnailImage, filePath); err != nil {return nil, errors.Wrap(err, "failed to save thumbnail file")}