From 594670fdad12a6536bc4e670184753ae8fb19348 Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Sun, 5 Jan 2020 16:36:02 -0800 Subject: [PATCH] Face browsing works Signed-off-by: James Ketrenos --- frontend/face-explorer.html | 12 ++++++++++-- server/routes/photos.js | 8 +++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/frontend/face-explorer.html b/frontend/face-explorer.html index bd17c4b..0af1f99 100644 --- a/frontend/face-explorer.html +++ b/frontend/face-explorer.html @@ -18,12 +18,13 @@ body { white-space: nowrap; z-index: 100; background: rgba(0, 0, 0, 0.5); + padding: 0.5em; } .view { display: inline-block; - width: 200px; - height: 200px; + width: 100px; + height: 100px; cursor: pointer; box-sizing: border-box; margin: 0 1em; @@ -31,6 +32,9 @@ body { font-weight: bold; vertical-align: bottom; text-align: center; + background-position: 50% 50%; + background-repeat: no-repeat; + background-size: contain; } .face { @@ -198,6 +202,10 @@ function loadPhoto(index) { document.getElementById("loading").textContent = "0%"; + const bar = document.getElementById("bar"); + if (bar) { + bar.parentElement.removeChild(bar); + } xml.onprogress = function (event) { var alpha = 0; if (event.total) { diff --git a/server/routes/photos.js b/server/routes/photos.js index 815b49c..9641b45 100755 --- a/server/routes/photos.js +++ b/server/routes/photos.js @@ -801,10 +801,6 @@ function getFacesForPhoto(id) { type: photoDB.Sequelize.QueryTypes.SELECT, raw: true }).then((faceIds) => { - let ids = faceIds.map((face) => { - return (face.face1Id == face.id) ? face.face2Id : face.face1Id; - }); - return photoDB.sequelize.query( "SELECT photos.id,faces.id AS faceId,fd.distance,albums.path,photos.filename " + "FROM faces " + @@ -817,7 +813,9 @@ function getFacesForPhoto(id) { ") " + "WHERE faces.id IN (:ids)", { replacements: { - ids: ids, + ids: faceIds.map((match) => { + return (match.face1Id == face.id) ? match.face2Id : match.face1Id; + }), faceId: face.id }, type: photoDB.Sequelize.QueryTypes.SELECT,