fix: trace thumbnail now uses trace_profile key_face.jpg for consistency
- Thumbnail endpoint was using select_rep_face (blurdetect) which could pick a different frame than the trace_profile's key_frame/key_face - This caused mismatch between Face Detail modal and thumbnail in trace list - Fix: add Step 1.5 to check trace_profile's key_face.jpg before falling back to select_rep_face - Ensures thumbnail always matches what Face Detail modal shows Verified: trace_21 thumbnail now matches key_face.jpg (same hash)
This commit is contained in:
@@ -768,6 +768,28 @@ async fn get_trace_thumbnail_inner(
|
||||
}
|
||||
}
|
||||
|
||||
// Step 1.5: Check trace_profile's key_face.jpg for consistency with Face Detail modal
|
||||
let profile_trace_dir = std::path::PathBuf::from(output_dir)
|
||||
.join(&file_uuid)
|
||||
.join(format!("trace_{}", trace_id));
|
||||
let key_face_path = profile_trace_dir.join("key_face.jpg");
|
||||
if key_face_path.exists() {
|
||||
if let Ok(bytes) = tokio::fs::read(&key_face_path).await {
|
||||
if crate::core::thumbnail::validator::validate_jpeg(&bytes).is_ok() {
|
||||
tracing::info!(
|
||||
"[trace_thumbnail] Using trace_profile key_face.jpg: {}",
|
||||
key_face_path.display()
|
||||
);
|
||||
return Ok(Response::builder()
|
||||
.status(StatusCode::OK)
|
||||
.header(header::CONTENT_TYPE, "image/jpeg")
|
||||
.header(header::CACHE_CONTROL, "public, max-age=86400")
|
||||
.body(Body::from(bytes))
|
||||
.unwrap());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Step 2: Fallback to ffmpeg on-demand extraction
|
||||
let sel = select_rep_face(state.db.pool(), &file_uuid, trace_id, |e| {
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user