cache cover in jpeg format
Some checks failed
Release / Lint and test (push) Failing after 26m31s
Release / Run Release Please (push) Has been skipped
Release / Build, tag, and publish Docker image (push) Has been skipped
Release / Notify IRC (push) Has been skipped
Nightly Release / Check latest commit (push) Successful in 14s
Nightly Release / Build and release Docker image (push) Has been skipped
Nightly Release / Lint and test (push) Has been skipped

This commit is contained in:
2024-06-12 17:41:16 +08:00
parent cf5e87e62b
commit 853107fca6

View File

@@ -32,7 +32,7 @@ import (
const ( const (
coverDefaultSize = 600 coverDefaultSize = 600
coverCacheFormat = "png" coverCacheFormat = "jpg"
) )
func (c *Controller) ServeGetCoverArt(w http.ResponseWriter, r *http.Request) *spec.Response { func (c *Controller) ServeGetCoverArt(w http.ResponseWriter, r *http.Request) *spec.Response {
@@ -160,7 +160,7 @@ func coverScaleAndSave(reader io.Reader, cachePath string, size int) error {
// don't upscale images // don't upscale images
width = src.Bounds().Dx() width = src.Bounds().Dx()
} }
if err := imaging.Save(imaging.Resize(src, width, 0, imaging.Lanczos), cachePath); err != nil { if err := imaging.Save(imaging.Resize(src, width, 0, imaging.Lanczos), cachePath, imaging.JPEGQuality(80)); err != nil {
return fmt.Errorf("caching %q: %w", cachePath, err) return fmt.Errorf("caching %q: %w", cachePath, err)
} }
return nil return nil