People: Select best thumbnail depending on config options #22

This commit is contained in:
Michael Mayer 2021-06-02 12:12:30 +02:00
parent 6b7745ecef
commit f37b740ec8
2 changed files with 18 additions and 4 deletions

View file

@ -1,9 +1,10 @@
package classify
import (
"github.com/photoprism/photoprism/internal/face"
"strings"
"github.com/photoprism/photoprism/internal/face"
"github.com/photoprism/photoprism/pkg/txt"
)

View file

@ -835,11 +835,24 @@ func (ind *Index) detectFaces(jpeg *MediaFile) face.Faces {
return face.Faces{}
}
// TODO: Not all users have thumbs with this resolution.
thumbName, err := jpeg.Thumbnail(Config().ThumbPath(), "fit_1280")
var thumbSize string
// Select best thumbnail depending on configured size.
if Config().ThumbSize() < 1280 {
thumbSize = "fit_720"
} else {
thumbSize = "fit_1280"
}
thumbName, err := jpeg.Thumbnail(Config().ThumbPath(), thumbSize)
if err != nil {
log.Debugf("%s in %s", err, txt.Quote(jpeg.BaseName()))
log.Debugf("index: %s in %s (faces)", err, txt.Quote(jpeg.BaseName()))
return face.Faces{}
}
if thumbName == "" {
log.Debugf("index: thumb %s not found in %s (faces)", thumbSize, txt.Quote(jpeg.BaseName()))
return face.Faces{}
}